note 110270 added to soapvar.soapvar
| From: | effectiveit at online dot nl | Date: | Sat, 06 Oct 2012 12:23:13 +0000 |
| Subject: | note 110270 added to soapvar.soapvar | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-191160@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 69.147.83.199
Probable Submitter: 82.157.160.232
----
Manual Page -- http://www.php.net/manual/en/soapvar.soapvar.php
Edit -- https://master.php.net/note/edit/110270
Del: integrated -- https://master.php.net/note/delete/110270/integrated
Del: useless -- https://master.php.net/note/delete/110270/useless
Del: bad code -- https://master.php.net/note/delete/110270/bad+code
Del: spam -- https://master.php.net/note/delete/110270/spam
Del: non-english -- https://master.php.net/note/delete/110270/non-english
Del: in docs -- https://master.php.net/note/delete/110270/in+docs
Del: other reasons-- https://master.php.net/note/delete/110270
Reject -- https://master.php.net/note/reject/110270
Search -- https://master.php.net/manage/user-notes.php