tag:forum.selfhtml.org,2005:/self Frage zu DOM-XML – SELFHTML-Forum 2007-02-01T11:12:35Z https://forum.selfhtml.org/self/2007/feb/1/frage-zu-dom-xml/1074347#m1074347 Sebastian kosmos1@gmx.net 2007-02-01T11:12:35Z 2007-02-01T11:12:35Z Frage zu DOM-XML <p>Hallo!</p> <p>Ich habe eine XML-Struktur, die ungefähr so aussieht:</p> <p><locations><br>   <location a="1" b="2"><br>     <title>Lokation 1</title><br>     <irgendeinTag>abc</irgendeinTag><br>     <subRegions sr_a="0" sr_b="1" sr_c="0" /><br>   </location><br> </locations></p> <p>gehe ich mit</p> <p>$locations = $xpath->query( "//location" );</p> <p>foreach( $locations as $location ) { }</p> <p>die einzelnen Locations durch. Die Variable $subregion enthält einen beliebigen String (z.B. sr_a oder sr_y).</p> <p>Nun will ich, dass mit DOM-XML der komplette <location>-Node gelöscht wird, wenn entweder</p> <p>a) das Attribut mit dem Namen, der in $subregion gespeichert ist, im <subRegions>-Node nicht vorhanden ist<br>   b) oder dieses Attribut den Wert 0 hat.</p> <p>Wie mache ich das möglichst einfach?</p> <p>Liebe Grüße<br> Sebastian</p>