Hallo
Ich versuche schon seit einiger Zeit eine XML-Datei in PHP zu parsen. Leider habe ich bis jetzt immer noch Probleme mit den Daten, die in einem bestimmten Namespace liegen.
Ich möchte eine GPX-Datei einlesen und mit einer anderen GPX vergleichen. Wenn die Daten in der zweiten Datei nicht vorhanden sind, dann sollen Sie dort eingefügt werden. Das Einlesen klappt auch soweit sehr gut, nur leider komme ich nicht an die Daten ran, die im Namespace "groundspeak" liegen. Wie kann ich diese Daten lesen und in der Zeildatei auch wieder genauso einfügen?
Code:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<gpx xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.topografix.com/GPX/1/0" version="1.0" creator="Groundspeak Pocket Query" xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd http://www.groundspeak.com/cache/1/0 http://www.groundspeak.com/cache/1/0/cache.xsd">
<name>All New</name>
<desc>Geocache file generated by Groundspeak</desc>
<author>Groundspeak</author>
<time>2007-02-13T21:49:49.2832334-08:00</time>
<keywords>cache, geocache, groundspeak</keywords>
<bounds minlat="42.765117" minlon="6.0872" maxlat="54.612" maxlon="18.430167"/>
<wpt lat="50.076033" lon="10.753183">
<time>2007-03-24T00:00:00.0000000-08:00</time>
<name>GCKB4O</name>
<desc>Haßberg Stammtisch... by coldfinger, Event Cache (1.5/1)</desc>
<url>http://www.geocaching.com/seek/cache_details.aspx?guid=c6378fa0-c289-4e73-bc98-4d1245d0d759</url>
<urlname>Haßberg Stammtisch...</urlname>
<sym>Geocache</sym>
<type>Geocache|Event Cache</type>
<groundspeak:cache xmlns:groundspeak="http://www.groundspeak.com/cache/1/0" id="165626" available="True" archived="False">
<groundspeak:name>Haßberg Stammtisch...</groundspeak:name>
<groundspeak:placed_by>coldfinger</groundspeak:placed_by>
<groundspeak:owner id="100787">coldfinger</groundspeak:owner>
<groundspeak:type>Event Cache</groundspeak:type>
<groundspeak:container>Not chosen</groundspeak:container>
<groundspeak:difficulty>1.5</groundspeak:difficulty>
<groundspeak:terrain>1</groundspeak:terrain>
<groundspeak:country>Germany</groundspeak:country>
<groundspeak:state>
</groundspeak:state>
<groundspeak:short_description html="False">Eine Einladung zu einem regelmäßigen Stammtisch. Nächster Termin: Samstag, 24.03.07 18:00</groundspeak:short_description>
<groundspeak:long_description html="False">
</groundspeak:long_description>
<groundspeak:encoded_hints></groundspeak:encoded_hints>
<groundspeak:logs>
<groundspeak:log id="22937864">
<groundspeak:date>2007-01-29T08:00:00</groundspeak:date>
<groundspeak:type>Write note</groundspeak:type>
<groundspeak:finder id="100787">coldfinger</groundspeak:finder>
<groundspeak:text encoded="False">Vielen Dank</groundspeak:text>
</groundspeak:log>
</groundspeak:logs>
</groundspeak:cache>
</wpt>
</gpx>