note 110270 deleted from soapvar.soapvar by danbrown
| From: | danbrown@php.net | Date: | Wed, 17 Oct 2012 21:26:55 +0000 |
| Subject: | note 110270 deleted from soapvar.soapvar by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-191401@lists.php.net to get a copy of this message | ||
Note Submitter: effectiveit at online dot nl
----
There's an error in there of course - the extra parameters for SoapVar come from my own
project.
As I am unable to edit the note itself, here it is again but now correct:
A better way of circumventing the bug in SoapVar (not being able to parse an XML string including a
declaration) is the following:
// create a DOMDocument $dom first
$nodes = $dom -> getElementsByTagName ('anyElement');
$node = $nodes -> item(0);
$result = new SoapVar ($dom -> saveXML($node), XSD_ANYXML);
Normally, anyElement will be the root element of the DOM.
saveXML() without parameters will include the declaration in the resulting string, whereas saveXML
with a paramater saves the DOM in a string without the declaration, so this is parsable by SoapVar.