M
marco
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=...-8&oe=UTF-8&q=mac+bittorent+sites&btnG=Search</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=...-8&oe=UTF-8&q=mac+bittorent+sites&btnG=Search</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>
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=...-8&oe=UTF-8&q=mac+bittorent+sites&btnG=Search</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=...-8&oe=UTF-8&q=mac+bittorent+sites&btnG=Search</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>