xml parsing issue

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

xml parsing issue

Post by itsmani1 »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I am trying to parse this xml but when it comes to 'D'angelo' on 3rd row it gives me error. any help?

thanks
[syntax="xml"]
<?xml version="1.0" encoding="utf-8" ?> 
  <ROOT>
  <METHODINFO>
  <channelName>Basic View</channelName> 
  <methodName>GetAllEvents</methodName> 
  <parameters>SecurityToken=2220</parameters> 
  <processTime type="milliseconds">70.7813</processTime> 
  </METHODINFO>
  <row EventID="207" EventName="Cubanismo!" EventTypeID="2" CategoryID="2" /> 
  <row EventID="211" EventName="Cypress Hill" EventTypeID="2" CategoryID="2" /> 
  <row EventID="212" EventName="D'angelo" EventTypeID="2" CategoryID="2" /> 
  <row EventID="72" EventName="Bela & Flecktones" EventTypeID="2" CategoryID="2" /> 
  <row EventID="73" EventName="Ben Folds" EventTypeID="2" CategoryID="2" /> 
  </DATA>
 </ROOT>
Error:XML error: XML_ERR_NAME_REQUIRED at line 11


feyd | Please use[/syntax]

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

parser code?

btw: The xml snippet is invalid.
  • & marks the start of an entity therefore EventName="Bela & Flecktones" is not allowed. see http://www.w3.org/TR/REC-xml/#sec-predefined-ent
  • There's no opening tag for </DATA>
  • xml is case-sensitive therefore <root> and </ROOT> are not corresponding tags
Post Reply