Re: I must be an XML parser idiot

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2004-10-28 at 14:26, Jay Blanchard wrote:
> Good afternoon gurus and gurettes!
> 
> ***** example code *****
> /* functions for XML parser */
> function dataHandler($parser, $data){
> 	echo $data . "<br>\n";
> }
> function StartTag($parser, $name, $attribute){
> 	if("servicebrandname" == $name){
> 		echo "-----<br>\n";
> 	}
> }
> function EndTag($parser, $name){
> 	if("servicebrandname" == $name){
> 		echo "-----<br>\n";
> 	}
> }
> 
> /* create a parser */
> if(!($covadParser = xml_parser_create())){
> 	echo "Failed to create parser<br>\n";
> 	exit();
> }
> /* set handlers for parser */
> xml_set_character_data_handler($covadParser, "dataHandler");
> xml_set_element_handler($covadParser, "StartTag", "EndTag");
> 
> /* let's parse! */
> if(($readXML = fopen("/usr/feynman/ADHOC/covad/testRecp.xml", "r"))){
> 	while($lineXML = fread($readXML, 1024)){
> 		echo $lineXML;
> 		xml_parse($covadParser, $lineXML, TRUE);
> 	}
> }
> ***** end code *****
> 
> I expect what I get back to look like....
> TeleSurfer DSL+IP - Shared Line (Professional-Install) 
> SOHO Internet Access 6.0/768 (Self-Install)
> 
> But it is not coming back this way. Do I posess a fundamental
> misunderstanding of the way the xml parser is supposed to work?

Could you send an XML sample please. And the output that you do get for
it. Without those it's hard to say.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux