hi everybody, I'm starting with the php DOM tools with some success. I want the user to dynamically alter the values of an xml tag (<Filter>) and incrustate this tag in a predefined XML. This original XML is like this: ... <Rule> <Filter> <PropertyIsEqualTo> <PropertyName>userID</PropertyName> <Literal>nom USUARI</Literal> </PropertyIsEqualTo> </Filter> <Other_things> </Other_things> </Rule> After executing the code (showed below), the XML tag is inserted but INSIDE of <Filter> tag, and should go AFTER. This is the wrong XML: <Filter> <PropertyIsEqualTo> <PropertyName>userID</PropertyName> <Literal>nom USUARI</Literal> </PropertyIsEqualTo> ---->the new <Filter> in wrong position <Filter> <PropertyIsEqualTo> <PropertyName>genus</PropertyName> <Literal>XXX</Literal> </PropertyIsEqualTo> </Filter> </Filter> Thanks everybody, this is the code: <? $xmlstr =<<<XML <Filter xmlns:gml="http://www.opengis.net/gml"> <PropertyIsEqualTo> <PropertyName>genus</PropertyName> <Literal>valor A PASSAR</Literal> </PropertyIsEqualTo> </Filter> $sxe = simplexml_load_string($xmlstr); //Values we will pass to the new <Filter> to insert $species=array('ontophaugs332','copris'); $dom = new DOMDocument; //XML we will insert the data to $dom -> load('edit_iberia3.xml'); //Where will be the data inserted $where_to_insert= $dom->getElementsByTagName('Filter')->item(0);//->item(0); //we pass parameters of the array foreach ($species as $sp=>$value) { $sxe->PropertyIsEqualTo->Literal=$value; //This function takes the node NODE of class SimpleXML and makes it into a DOMElement node $node = dom_import_simplexml($sxe); //This function returns a copy of the node to import and associates it with the current document. $node = $dom->importNode($node, true); $before_insert->appendChild($node); } //we save the XML file echo $dom->save(simples2); ?> -- View this message in context: http://www.nabble.com/php-DOM-question-tf4838570.html#a13842759 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