cvs: peardoc /en/package/xml xml-parser.xml /en/package/xml/xml-parser input.xml

From: Date: Sat, 15 May 2004 23:38:55 +0000
Subject: cvs: peardoc /en/package/xml xml-parser.xml /en/package/xml/xml-parser input.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-4004@lists.php.net to get a copy of this message
schst Sat May 15 19:38:55 2004 EDT Added files: /peardoc/en/package/xml/xml-parser input.xml Modified files: /peardoc/en/package/xml xml-parser.xml Log: added docs in setInput*() methods http://cvs.php.net/diff.php/peardoc/en/package/xml/xml-parser.xml?r1=1.3&r2=1.4&ty=u Index: peardoc/en/package/xml/xml-parser.xml diff -u peardoc/en/package/xml/xml-parser.xml:1.3 peardoc/en/package/xml/xml-parser.xml:1.4 --- peardoc/en/package/xml/xml-parser.xml:1.3 Sat May 15 19:13:52 2004 +++ peardoc/en/package/xml/xml-parser.xml Sat May 15 19:38:53 2004 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <sect1 id="package.xml.xml-parser"> <title>XML_Parser</title> @@ -8,6 +8,7 @@ &package.xml.xml-parser.intro; &package.xml.xml-parser.example; &package.xml.xml-parser.modes; + &package.xml.xml-parser.input; </sect1> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/co.php/peardoc/en/package/xml/xml-parser/input.xml?r=1.1&p=1 Index: peardoc/en/package/xml/xml-parser/input.xml +++ peardoc/en/package/xml/xml-parser/input.xml <!-- $Revision: 1.1 $ --> <refentry id="package.xml.xml-parser.input"> <refnamediv> <refname>Choosing input</refname> <refpurpose>Explanation of different types of input data</refpurpose> </refnamediv> <refsect1 id="package.xml.xml-parser.input.refsect1"> <title>Selecting the input for XML_Parser</title> <para> XML_Parser is able to parse from several inputs: <itemizedlist> <listitem> <para>filesystem or anything that can be accessed via stream</para> </listitem> <listitem> <para>strings</para> </listitem> <listitem> <para>resources</para> </listitem> </itemizedlist> </para> <para> You will have to set the input using <function>setInputFile</function>, <function>setInputString</function> or <function>setInput</function> and then call <function>parse</function> to start the XML processing. </para> </refsect1> <refsect1 id="package.xml.xml-parser.input.refsect2"> <title>Parsing from a file</title> <para> To parse from a file or URL, you'll have to set the name or URI using <function>XML_Parser::setInputFile</function>. You may not only use files located on the filesystem, but any location that can be opened using <function>fopen</function>. You may combine this functionality with the <ulink url="http://www.php.net/manual/en/ref.stream.php">stream functions</ulink> or PEAR's <ulink url="http://pear.php.net/packages.php?catpid=35&amp;catname=Streams">Streams packages</ulink> to parse documents from shared memory, databases or anything else. </para> <para> You may also use any of PHP's <ulink url="http://www.php.net/manual/en/wrappers.php">built-in</ulink> wrappers to open HTTP or FTP locations as well as STDIN. </para> </refsect1> <refsect1 id="package.xml.xml-parser.input.refsect3"> <title>Parsing from a string</title> <para> To parse an XML string, pass the string to XML_Parser (or your subclass of XML_Parser) using <function>XML_Parser::setInputString</function>. A big advantage of SAX-based parsing is that the parser does not have to read the whole XML document to process it. If you are parsing very large documents, you should aboid <function>setInputString</function> and use <function>setInput</function> or <function>setInputFile</function> instead. </para> </refsect1> <refsect1 id="package.xml.xml-parser.input.refsect4"> <title>Parsing from any resource</title> <para> There's a third, but seldomly used way to specify XML_Parser's input. XML_Parser allows you to pass a PHP resource, like a file pointer that has been returned by <function>fopen</function>. This can be useful, if you are generating the document on-the-fly and already opened it before. Instead of closing the file and passing its name to XML_Parser, you may simply use <function>XML_Parser::setInput</function> to pass the resource. Make sure that the file pointer is at the correct location in your file using <function>fseek</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 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 -->

« previous php.pear.doc (#4004) next »