note 79048 added to function.dom-domdocument-createtextnode

From: Date: Thu, 08 Nov 2007 09:05:50 +0000
Subject: note 79048 added to function.dom-domdocument-createtextnode
Groups: php.notes 
Request: Send a blank email to php-notes+get-132103@lists.php.net to get a copy of this message
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> ---- Server IP: 64.71.164.2 Probable Submitter: 193.195.220.227 (proxied: 192.0.0.254) ---- Manual Page -- http://www.php.net/manual/en/function.dom-domdocument-createtextnode.php Edit -- https://master.php.net/note/edit/79048 Del: integrated -- https://master.php.net/note/delete/79048/integrated Del: useless -- https://master.php.net/note/delete/79048/useless Del: bad code -- https://master.php.net/note/delete/79048/bad+code Del: spam -- https://master.php.net/note/delete/79048/spam Del: non-english -- https://master.php.net/note/delete/79048/non-english Del: in docs -- https://master.php.net/note/delete/79048/in+docs Del: other reasons-- https://master.php.net/note/delete/79048 Reject -- https://master.php.net/note/reject/79048 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#132103) next »