By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,026 Members | 1,222 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,026 IT Pros & Developers. It's quick & easy.

xml parsing: newby

P: n/a
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>
Jul 20 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.