cvs: peardoc /en/package/xml xml-parser.xml /en/package/xml/xml-parser modes.xml
| From: | Stephan Schmidt | Date: | Sat, 15 May 2004 23:13:53 +0000 |
| Subject: | cvs: peardoc /en/package/xml xml-parser.xml /en/package/xml/xml-parser modes.xml | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-4003@lists.php.net to get a copy of this message | ||
schst Sat May 15 19:13:53 2004 EDT
Added files:
/peardoc/en/package/xml/xml-parser modes.xml
Modified files:
/peardoc/en/package/xml xml-parser.xml
Log:
added docs on parser modes
http://cvs.php.net/diff.php/peardoc/en/package/xml/xml-parser.xml?r1=1.2&r2=1.3&ty=u
Index: peardoc/en/package/xml/xml-parser.xml
diff -u peardoc/en/package/xml/xml-parser.xml:1.2 peardoc/en/package/xml/xml-parser.xml:1.3
--- peardoc/en/package/xml/xml-parser.xml:1.2 Fri May 7 15:31:39 2004
+++ peardoc/en/package/xml/xml-parser.xml Sat May 15 19:13:52 2004
@@ -1,4 +1,4 @@
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
<sect1 id="package.xml.xml-parser">
<title>XML_Parser</title>
@@ -7,6 +7,7 @@
</para>
&package.xml.xml-parser.intro;
&package.xml.xml-parser.example;
+ &package.xml.xml-parser.modes;
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
http://cvs.php.net/co.php/peardoc/en/package/xml/xml-parser/modes.xml?r=1.1&p=1
Index: peardoc/en/package/xml/xml-parser/modes.xml
+++ peardoc/en/package/xml/xml-parser/modes.xml
<!-- $Revision: 1.1 $ -->
<refentry id="package.xml.xml-parser.modes">
<refnamediv>
<refname>Modes</refname>
<refpurpose>Explanation of possible parsing modes</refpurpose>
</refnamediv>
<refsect1 id="package.xml.xml-parser.modes.refsect1">
<title>Parser modes of XML_Parser</title>
<para>
XML_Parser provides two modes for parsing:
<itemizedlist>
<listitem>
<para>func</para>
</listitem>
<listitem>
<para>event</para>
</listitem>
</itemizedlist>
</para>
<para>
In the 'event' mode, XML_Parser will always call the methods
<function>startHandler</function> and <function>endHandler</function>,
independent of the tag name. In these methods you'll have to check
for tha tagname which, is passed as the second parameter and decide
what you need to do. In most cases, this is done with a switch/case
statement.
</para>
<para>
In the 'func' mode, XML_Parser will call different methods
based on the name of the tag. This allows you to dispatch different
tags to different methods. The methods to handle the start tag have
to be called <function>xmltag_[tagname]</function>, where [tagname]
will has to be substituted by the name of the element that you
wish to process. Methods to handle closing tags have to be named
<function>xmltag_[tagname]_</function> (distinguishes from the start
element handler using a traling underscore).
</para>
<para>
If a method does not exist, XML_Parser will skip the tag without
handling the element.
</para>
</refsect1>
<refsect1 id="package.xml.xml-parser.modes.refsect2">
<title>Setting the mode</title>
<para>
There are two ways of setting the mode:
<itemizedlist>
<listitem>
<para>
Specifying the mode in the constructor as the second parameter.
</para>
<para>
In the subclass of XML_Parser that you implemented to process the XML
documents, you will have to call
<function>XML_Parser::XML_Parser</function>
in the constructor. This method accepts the mode as its second parameter.
</para>
</listitem>
<listitem>
<para>Setting the mode using
<function>XML_Parser::setMode</function>.</para>
</listitem>
</itemizedlist>
</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
-->