mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-19 18:38:55 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@278460 c90b9560-bf6c-de11-be94-00142212c4b1
174 lines
4.6 KiB
XML
174 lines
4.6 KiB
XML
<?xml version='1.0' encoding='iso-8859-1'?>
|
|
<!-- $Revision: 1.13 $ -->
|
|
<refentry xml:id="function.tidy-parse-string" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>tidy_parse_string</refname>
|
|
<refpurpose>Parse a document stored in a string</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<para>Procedural style:</para>
|
|
<methodsynopsis>
|
|
<type>tidy</type><methodname>tidy_parse_string</methodname>
|
|
<methodparam><type>string</type><parameter>input</parameter></methodparam>
|
|
<methodparam choice="opt"><type>mixed</type><parameter>config</parameter></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>encoding</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>Object oriented style:</para>
|
|
<methodsynopsis>
|
|
<type>bool</type><methodname>tidy->parseString</methodname>
|
|
<methodparam><type>string</type><parameter>input</parameter></methodparam>
|
|
<methodparam choice="opt"><type>mixed</type><parameter>config</parameter></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>encoding</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Parses a document stored in a string.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>input</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
The data to be parsed.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>config</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
The config <parameter>config</parameter> can be passed either as an
|
|
array or as a string. If a string is passed, it is interpreted as the
|
|
name of the configuration file, otherwise, it is interpreted as the
|
|
options themselves.
|
|
</para>
|
|
<para>
|
|
For an explanation about each option, visit <link
|
|
xlink:href="&url.tidy.conf;">&url.tidy.conf;</link>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>encoding</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
The <parameter>encoding</parameter> parameter sets the encoding for
|
|
input/output documents. The possible values for encoding are:
|
|
<literal>ascii</literal>, <literal>latin0</literal>, <literal>latin1</literal>,
|
|
<literal>raw</literal>, <literal>utf8</literal>, <literal>iso2022</literal>,
|
|
<literal>mac</literal>, <literal>win1252</literal>, <literal>ibm858</literal>,
|
|
<literal>utf16</literal>, <literal>utf16le</literal>, <literal>utf16be</literal>,
|
|
<literal>big5</literal>, and <literal>shiftjis</literal>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Returns a new <classname>tidy</classname> instance.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title><function>tidy_parse_string</function> example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
ob_start();
|
|
?>
|
|
|
|
<html>
|
|
<head>
|
|
<title>test</title>
|
|
</head>
|
|
<body>
|
|
<p>error<br>another line</i>
|
|
</body>
|
|
</html>
|
|
|
|
<?php
|
|
|
|
$buffer = ob_get_clean();
|
|
$config = array('indent' => TRUE,
|
|
'output-xhtml' => TRUE,
|
|
'wrap' => 200);
|
|
|
|
$tidy = tidy_parse_string($buffer, $config, 'UTF8');
|
|
|
|
$tidy->cleanRepair();
|
|
echo $tidy;
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<title>
|
|
test
|
|
</title>
|
|
</head>
|
|
<body>
|
|
<p>
|
|
error<br />
|
|
another line
|
|
</p>
|
|
</body>
|
|
</html>
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="notes">
|
|
&reftitle.notes;
|
|
¬e.tidy.2only;
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<simplelist>
|
|
<member><function>tidy_parse_file</function></member>
|
|
<member><function>tidy_repair_file</function></member>
|
|
<member><function>tidy_repair_string</function></member>
|
|
</simplelist>
|
|
</refsect1>
|
|
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"../../../../manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|