[Solved] Re: [PHP] DOM: Problem with loadXML(), createProcessingInstruction()

From: Date: Tue, 19 Sep 2006 19:32:44 +0000
Subject: [Solved] Re: [PHP] DOM: Problem with loadXML(), createProcessingInstruction()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-241954@lists.php.net to get a copy of this message
Has anyone found a workaround for this; a workaround the fact that loadXML() completely replaces the existing document structure?
It's amazing what you find out after you've already made yourself look foolish. $xmlStr = '<root><child_element>blah</child_element></root>'; $doc = new DOMDocument( '1.0', 'UTF-8' ); $docFragment = $doc->createDocumentFragment(); $docFragment->appendXML( $xmlStr ); // Why this isn't called also loadXML()
                                                               // I have no idea.  It would make sense
                                                               // that it would be so as to maintain
                                                               // consistency in names of methods
                                                               // where it relates to functionality,
                                                               // particularly when that functionality is
                                                               // similar across classes.
$doc->appendChild( $doc->createProcessingInstruction( 'blah', 'blah' ); $doc->appendChild( $docFragment ); echo $doc->saveXML();

« previous php.general (#241954) next »