xml parsing: newby

Discussion in 'XML' started by marco, Sep 2, 2004.

  1. marco

    marco Guest

    I'm trying to parse a xml bookmarkpage with php. I found a very useful
    example script about how you can parse a xml document with php. The
    scriptworks really smooth. The xml test document (See ‘Testxml'
    beneath) is parsed correctly and with the php sniplet:

    $counting=count($xmlC->obj_data->DATA[0]->IP_RECORD); //to find out
    the number of elements in the array

    I can figure out how much IP_RECORD elements (=2) there are in the
    DATA array. But the bookmarks xml file (see the ‘bookmarks xml'
    beneath the ‘Testxml' document ) has a totally different structure
    which looks very strange to me if you compare it with the ‘Testxml'
    document. There are no unique tagnames to seperate the different
    bookmarks so I have no idea how to filter out the 6 bookmarks
    elements.


    I'm a xml newby so probably this notation is not strange at all and a
    piece of cake....well I'm anctious to know if somebody can spread some
    light on this matter.

    Thank you for your attention,

    Marco

    //*****************************Testxml*******************************
    <?xml version="1.0" encoding="utf-8" ?>
    <DATA>
    <REPORT_DATE>02-Sep-2004</REPORT_DATE>
    <IP_RECORD>
    <ADDRESS>00.00.00.00</ADDRESS>
    <HOSTNAME>superfries.net</HOSTNAME>
    <OWNER>VanGoghlaan 12, 2011 JL Amsterdam</OWNER>
    </IP_RECORD>

    <IP_RECORD>
    <ADDRESS>11.11.11.11</ADDRESS>
    <OWNER>2011 JL Amsterdam, Netherlands</OWNER>
    </IP_RECORD>
    </DATA>

    //*****************************bookmarksxml*******************************
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
    "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>Children</key>
    <array>
    <dict>
    <key>Children</key>
    <array>
    <dict>
    <key>URIDictionary</key>
    <dict>
    <key></key>
    <string>http://superfries.net/</string>
    <key>lastVisitedDate</key>
    <string>118508122.5</string>
    <key>title</key>
    <string>superfries.net</string>
    </dict>
    <key>URLString</key>
    <string>http://superfries.net/</string>
    <key>WebBookmarkType</key>
    <string>WebBookmarkTypeLeaf</string>
    <key>WebBookmarkUUID</key>
    <string>53C04206-154C-11D9-87E6-000A27AF41A0</string>
    </dict>
    <dict>
    <key>URIDictionary</key>
    <dict>
    <key></key>
    <string>http://groups.google.com/groups?hl=en&amp;lr=&amp;ie=UTF-8&amp;oe=UTF-8&amp;threadm=3f5c2d06%40news.comindico.com.au&amp;rnum=2&amp;prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26q%3Dmac%2Bbittorent%2Bsites%26btnG%3DSearch</string>
    <key>lastVisitedDate</key>
    <string>104930396.2</string>
    <key>title</key>
    <string>Google Groups:ViewThread "huge bittorent site
    list"</string>
    </dict>
    <key>URLString</key>
    <string>http://groups.google.com/groups?hl=en&amp;lr=&amp;ie=UTF-8&amp;oe=UTF-8&amp;threadm=3f5c2d06%40news.comindico.com.au&amp;rnum=2&amp;prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26q%3Dmac%2Bbittorent%2Bsites%26btnG%3DSearch</string>
    <key>WebBookmarkType</key>
    <string>WebBookmarkTypeLeaf</string>
    <key>WebBookmarkUUID</key>
    <string>2632B284-99CF-11D8-97AF-000A27AF41A0</string>
    </dict>
    <dict>
    <key>URIDictionary</key>
    <dict>
    <key></key>
    <string>http://www.apple.com/</string>
    <key>title</key>
    <string>Apple</string>
    </dict>
    <key>URLString</key>
    <string>http://www.apple.com/</string>
    <key>WebBookmarkType</key>
    <string>WebBookmarkTypeLeaf</string>
    <key>WebBookmarkUUID</key>
    <string>52B43353-97CE-11D8-80C7-000A27AF41A0</string>
    </dict>
    </array>
    <key>Title</key>
    <string>QuickTime</string>
    <key>WebBookmarkType</key>
    <string>WebBookmarkTypeList</string>
    <key>WebBookmarkUUID</key>
    <string>52B65E14-97CE-11D8-80C7-000A27AF41A0</string>
    </dict>
    </array>
    <key>Title</key>
    <string>Imported IE Favorites</string>
    <key>WebBookmarkType</key>
    <string>WebBookmarkTypeList</string>
    <key>WebBookmarkUUID</key>
    <string>52B52DFC-97CE-11D8-80C7-000A27AF41A0</string>
    </dict>
    </array>
    <key>WebBookmarkFileVersion</key>
    <integer>1</integer>
    <key>WebBookmarkType</key>
    <string>WebBookmarkTypeList</string>
    <key>WebBookmarkUUID</key>
    <string>52B42B9F-97CE-11D8-80C7-000A27AF41A0</string>
    </dict>
    </plist>
     
    marco, Sep 2, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Darren
    Replies:
    6
    Views:
    367
    Darren
    Mar 13, 2007
  2. Darren
    Replies:
    1
    Views:
    417
    Martin Honnen
    Mar 13, 2007
  3. John Levine
    Replies:
    0
    Views:
    733
    John Levine
    Feb 2, 2012
  4. Erik Wasser
    Replies:
    5
    Views:
    465
    Peter J. Holzer
    Mar 5, 2006
  5. EF
    Replies:
    7
    Views:
    134
    John Bokma
    May 31, 2006
Loading...

Share This Page