note 79048 deleted from function.dom-domdocument-createtextnode by felipe

From: Date: Mon, 24 Dec 2007 01:55:39 +0000
Subject: note 79048 deleted from function.dom-domdocument-createtextnode by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-133931@lists.php.net to get a copy of this message
Note Submitter: carltond at aac-services dot co dot uk ---- I wanted to add a raw XML string to the XML I was creating but had problems using DOMDocument->createTextNode() as it encoded my tags. Have a look at DOMDocument->createDocumentFragment() and the the "appendXML" method...an example from the page <?php $doc = new DOMDocument(); $doc->loadXML("<root/>"); $f = $doc->createDocumentFragment(); $f->appendXML("<foo>text</foo><bar>text2</bar>"); $doc->documentElement->appendChild($f); echo $doc->saveXML(); ?> Will output... <?xml version="1.0" ?> <root><foo>text</foo><bar>text2</bar></root>

« previous php.notes (#133931) next »