<?xml version='1.0' encoding='iso-8859-1'?> <!-- $Revision: 1.7 $ --> <refentry id="function.tidy-parse-string"> <refnamediv> <refname>tidy_parse_string</refname> <refpurpose> Parse a document stored in a string </refpurpose> </refnamediv> <refsect1> <title>Description</title> <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> <function>tidy_parse_string</function> parses a document stored in a string. </para> &tidy.conf-enc; <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> <para> The above example will output: </para> <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> ¬e.tidy.2only; <para> See also <function>tidy_parse_file</function>, <function>tidy_repair_file</function> and <function>tidy_repair_string</function>. </para> </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 -->