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
//*************** **************T estxml********* *************** *******
<?xml version="1.0" encoding="utf-8" ?>
<DATA>
<REPORT_DATE> 02-Sep-2004</REPORT_DATE>
<IP_RECORD>
<ADDRESS>00.00. 00.00</ADDRESS>
<HOSTNAME>super fries.net</HOSTNAME>
<OWNER>VanGoghl aan 12, 2011 JL Amsterdam</OWNER>
</IP_RECORD>
<IP_RECORD>
<ADDRESS>11.11. 11.11</ADDRESS>
<OWNER>2011 JL Amsterdam, Netherlands</OWNER>
</IP_RECORD>
</DATA>
//*************** **************b ookmarksxml**** *************** ************
<?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>URIDiction ary</key>
<dict>
<key></key>
<string>http://superfries.net/</string>
<key>lastVisite dDate</key>
<string>1185081 22.5</string>
<key>title</key>
<string>superfr ies.net</string>
</dict>
<key>URLStrin g</key>
<string>http://superfries.net/</string>
<key>WebBookmar kType</key>
<string>WebBook markTypeLeaf</string>
<key>WebBookmar kUUID</key>
<string>53C0420 6-154C-11D9-87E6-000A27AF41A0</string>
</dict>
<dict>
<key>URIDiction ary</key>
<dict>
<key></key>
<string>http://groups.google.c om/groups?hl=en&am p;lr=&ie=UT F-8&oe=UTF-8&threadm=3 f5c2d06%40news. comindico.com.a u&rnum=2&am p;prev=/groups%3Fhl%3De n%26lr%3D%26ie% 3DUTF-8%26oe%3DUTF-8%26q%3Dmac%2Bb ittorent%2Bsite s%26btnG%3DSear ch</string>
<key>lastVisite dDate</key>
<string>1049303 96.2</string>
<key>title</key>
<string>Googl e Groups:ViewThre ad "huge bittorent site
list"</string>
</dict>
<key>URLStrin g</key>
<string>http://groups.google.c om/groups?hl=en&am p;lr=&ie=UT F-8&oe=UTF-8&threadm=3 f5c2d06%40news. comindico.com.a u&rnum=2&am p;prev=/groups%3Fhl%3De n%26lr%3D%26ie% 3DUTF-8%26oe%3DUTF-8%26q%3Dmac%2Bb ittorent%2Bsite s%26btnG%3DSear ch</string>
<key>WebBookmar kType</key>
<string>WebBook markTypeLeaf</string>
<key>WebBookmar kUUID</key>
<string>2632B28 4-99CF-11D8-97AF-000A27AF41A0</string>
</dict>
<dict>
<key>URIDiction ary</key>
<dict>
<key></key>
<string>http://www.apple.com/</string>
<key>title</key>
<string>Apple </string>
</dict>
<key>URLStrin g</key>
<string>http://www.apple.com/</string>
<key>WebBookmar kType</key>
<string>WebBook markTypeLeaf</string>
<key>WebBookmar kUUID</key>
<string>52B4335 3-97CE-11D8-80C7-000A27AF41A0</string>
</dict>
</array>
<key>Title</key>
<string>QuickTi me</string>
<key>WebBookmar kType</key>
<string>WebBook markTypeList</string>
<key>WebBookmar kUUID</key>
<string>52B65E1 4-97CE-11D8-80C7-000A27AF41A0</string>
</dict>
</array>
<key>Title</key>
<string>Importe d IE Favorites</string>
<key>WebBookmar kType</key>
<string>WebBook markTypeList</string>
<key>WebBookmar kUUID</key>
<string>52B52DF C-97CE-11D8-80C7-000A27AF41A0</string>
</dict>
</array>
<key>WebBookmar kFileVersion</key>
<integer>1</integer>
<key>WebBookmar kType</key>
<string>WebBook markTypeList</string>
<key>WebBookmar kUUID</key>
<string>52B42B9 F-97CE-11D8-80C7-000A27AF41A0</string>
</dict>
</plist>