Cheap Web Hosting for Developers

PHP, MySQL, Java, Unix Cheap Web Hosting

CHAPTER 8 SIMPLE API FOR XML (SAX)

Filed under: PHP and XML — webmaster @ 17:31

CHAPTER 8 SIMPLE API FOR XML (SAX) 271 1. Define functions to handle events. 2. Create the parser. 3. Set any parser options. 4. Register the handlers (the functions you defined to handle events) with the parser. 5. Begin parsing. 6. Perform error checking. 7. Free the parser. Listing 8-1 contains a small example of using this extension, following the previous steps. I have used comments in the application to indicate the different steps. Listing 8-1. Sample Application Using the xml Extension Hello World ‘; /* start element handler function */ function startElement($parser, $name, $attribs) { print “<$name"; foreach ($attribs AS $attName=>$attValue) { print ” $attName=”.’”‘.$attValue.’”‘; } print “>”; } /* end element handler function */ function endElement($parser, $name) { print ““; } /* cdata handler function */ function chandler($parser, $data) { print $data; } /* Create parser */ $xml_parser = xml_parser_create();

Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Clan Web Hosting services

No Comments

No comments yet.

RSS feed for comments on this post. TrackBack URI

Sorry, the comment form is closed at this time.

Powered by Cheap Web Hosting