please, I need some help with php DOM, for me it's becoming a hell! After trying other methods (check message from 19th november, called "php DOM question"), I'm getting a little more success to manipulate XML. >From the code you can see below you generate this xml. Now I just want to keep only the initial <Or> and the final </Or>. How can I access and delete the other (the "between" tags)? I suppose there is no way to create an initial <Or> without the associated </Or>. Thanks a lot, Pere This is the WRONG XML generated from code. ... <And> <PropertyIsEqualTo> <PropertyName>genus</PropertyName> <Literal>ontophaugs332</Literal> </PropertyIsEqualTo> <Or> <PropertyIsEqualTo> <PropertyName>genus</PropertyName> <Literal>copris</Literal> </PropertyIsEqualTo> </Or> <Or> <PropertyIsEqualTo> <PropertyName>genus</PropertyName> <Literal>copris2</Literal> </PropertyIsEqualTo> </Or> </And> <?php $species=array('ontophaugs332','copris','copris2'); $dom = new DOMDocument; //XML we will insert the data to $dom -> load('edit_iberia3.xml'); $count=count($species); foreach ($species as $sp=>$value) { //we pass parameters of the array $where_to_insert= $dom->getElementsByTagName('And')->item(0); $child = $dom->createElement('Or'); $or=$where_to_insert->appendChild($child); $child = $dom->createElement('PropertyIsEqualTo'); $first=$or->appendChild($child); $child2 = $dom->createElement('PropertyName'); $first->appendChild($child2); $child3 = $dom->createElement('Literal'); $first->appendChild($child3); //inserting the array data $values = $dom->createTextNode($value); $values = $child3->appendChild($values); } echo $dom->save(nou_iberia); ?> -- View this message in context: http://www.nabble.com/manipulating-XML-via-php-DOM-tf4845510.html#a13862945 Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php