cvs: peardoc /en/package/xml/xml-parser example.xml
| From: | Martin Jansen | Date: | Wed, 16 Feb 2005 09:16:46 +0000 |
| Subject: | cvs: peardoc /en/package/xml/xml-parser example.xml | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-5538@lists.php.net to get a copy of this message | ||
mj Wed Feb 16 04:16:46 2005 EDT
Modified files:
/peardoc/en/package/xml/xml-parser example.xml
Log:
* Added character data handler to the example of XML_Parser.
http://cvs.php.net/diff.php/peardoc/en/package/xml/xml-parser/example.xml?r1=1.2&r2=1.3&ty=u
Index: peardoc/en/package/xml/xml-parser/example.xml
diff -u peardoc/en/package/xml/xml-parser/example.xml:1.2
peardoc/en/package/xml/xml-parser/example.xml:1.3
--- peardoc/en/package/xml/xml-parser/example.xml:1.2 Sat Jul 3 10:10:44 2004
+++ peardoc/en/package/xml/xml-parser/example.xml Wed Feb 16 04:16:41 2005
@@ -1,4 +1,4 @@
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
<refentry id="package.xml.xml-parser.example">
<refnamediv>
<refname>Example</refname>
@@ -9,7 +9,8 @@
<title>Basic example</title>
<para>
This example shows you how to create a very simple parser that
- handles start and end elements (i.e. opening and closing tags)
+ handles start, end elements (i.e. opening and closing tags), and
+ character data (the "content" between the tags).
</para>
<programlisting role="php">
<![CDATA[
@@ -46,6 +47,18 @@
{
printf('handle end tag: %s<br />', $name);
}
+
+ /**
+ * handle character data
+ *
+ * @access private
+ * @param resource xml parser resource
+ * @param string character data
+ */
+ function cdataHandler($xp, $cdata)
+ {
+ // does nothing here, but might e.g. print $cdata
+ }
}
$p = &new myParser();