Login   Register  
PHP Classes

File: saxy_source.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of John Heinstein  >  SAXY XML parser  >  saxy_source.php  >  Download  
File: saxy_source.php
Role: Example script
Content type: text/plain
Description: Source code for the SAXY example
Class: SAXY XML parser
A Simple API for XML (SAX) parser
Author: By
Last change:
Date: 10 years ago
Size: 902 bytes


Class file image Download
SAXY_Test  {
SAXY_Test() {
$sp = new SAXY_Parser();
$sp->xml_set_element_handler(array(&$this"startElement"), array(&$this"endElement"));
$sp->parse("<book><title><![CDATA[How to use SAXY]]></title><author>John Heinstein</author></book>");
function startElement($parser$name$attributes) {
            echo (
"<br /><b>Open tag:</b> " $name  "<br /><b>Attributes:</b> " print_r($attributestrue)  . "<br />");
function endElement($parser$name) {
            echo (
"<br /><b>Close tag:</b> " $name  "<br />");
function charData($parser$text) {
            echo (
"<br /><b>Text node:</b> " $text  "<br />");
$st = new SAXY_Test();