Helpful Information
 
 
Category: Programming Languages More
Parsing XML

Hi, i'm using the PHP code form melonfire at :
http://www.devshed.com/Server_Side/...PHP1/page5.html

My question is :
So far, my xml code has been in the form like
1)
<title>The Hobbit</title>
<Pages>359</pages>

and everything seems fine.

But i'm wondering if its also possible to have the xml code like
2)
<title="The Hobbit" Pages="359" />

Would it be possible to parse XML with php when the XML code is like the second example??if so what would I have to change in the PHP code?


thanx

<title="The Hobbit" Pages="359" />

wouldn't/shouldn't be valid, but say
<book title="The Hobbit" Pages="359" />
would. As for using this method is php search the docs for whatever xml parser your using for "attributes". Which is what they are.

e.g. http://www.devshed.com/Server_Side/XML/XMLwithPHP/XMLwithPHP2/page4.html