Thread: Parsing XML

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2001
    Posts
    3
    Rep Power
    0

    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
  2. #2
  3. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2001
    Posts
    15
    Rep Power
    0
    <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/X...HP2/page4.html

IMN logo majestic logo threadwatch logo seochat tools logo