cvs: peardoc /en/package/xml xml-parser.xml /en/package/xml/xml-parser example.xml
| From: | Stephan Schmidt | Date: | Fri, 07 May 2004 19:31:39 +0000 |
| Subject: | cvs: peardoc /en/package/xml xml-parser.xml /en/package/xml/xml-parser example.xml | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-3918@lists.php.net to get a copy of this message | ||
schst Fri May 7 15:31:39 2004 EDT
Added files:
/peardoc/en/package/xml/xml-parser example.xml
Modified files:
/peardoc/en/package/xml xml-parser.xml
Log:
added example for XML_Parser
http://cvs.php.net/diff.php/peardoc/en/package/xml/xml-parser.xml?r1=1.1&r2=1.2&ty=u
Index: peardoc/en/package/xml/xml-parser.xml
diff -u peardoc/en/package/xml/xml-parser.xml:1.1 peardoc/en/package/xml/xml-parser.xml:1.2
--- peardoc/en/package/xml/xml-parser.xml:1.1 Fri May 7 14:10:08 2004
+++ peardoc/en/package/xml/xml-parser.xml Fri May 7 15:31:39 2004
@@ -1,4 +1,4 @@
-<!-- $Revision: 1.1 $ -->
+<!-- $Revision: 1.2 $ -->
<sect1 id="package.xml.xml-parser">
<title>XML_Parser</title>
@@ -6,6 +6,7 @@
Object-oriented abstraction for PHP's xml extension.
</para>
&package.xml.xml-parser.intro;
+ &package.xml.xml-parser.example;
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
http://cvs.php.net/co.php/peardoc/en/package/xml/xml-parser/example.xml?r=1.1&p=1
Index: peardoc/en/package/xml/xml-parser/example.xml
+++ peardoc/en/package/xml/xml-parser/example.xml
<!-- $Revision: 1.1 $ -->
<refentry id="package.xml.xml-parser.example">
<refnamediv>
<refname>Example</refname>
<refpurpose>Example for the usage of XML_Parser</refpurpose>
</refnamediv>
<refsect1 id="package.xml.xml-parser.example.example1">
<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)
</para>
<programlisting role="php">
<![CDATA[<?PHP
require_once 'XML/Parser.php';
class myParser extends XML_Parser
{
function myParser()
{
parent::XML_Parser();
}
/**
* handle start element
*
* @access private
* @param resource xml parser resource
* @param string name of the element
* @param array attributes
*/
function startHandler($xp, $name, $attribs)
{
printf('handle start tag: %s<br />', $name);
}
/**
* handle start element
*
* @access private
* @param resource xml parser resource
* @param string name of the element
*/
function endHandler($xp, $name)
{
printf('handle end tag: %s<br />', $name);
}
}
$p = &new myParser();
$result = $p->setInputFile('xml_parser_file.xml');
$result = $p->parse();
?>]]>
</programlisting>
<para>
This parser will just output the names of the opening and closing
tags that are found while parsing the document.
</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
-->