note 75443 added to ref.simplexml
| From: | MarcioAnnunciato at osu1 dot php dot net | Date: | Wed, 30 May 2007 11:15:45 +0000 |
| Subject: | note 75443 added to ref.simplexml | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-127017@lists.php.net to get a copy of this message | ||
You could parse a SOAP response like this:
<?
$xmlstr = <<<XML
<soap:Envelope xmlns:soap="schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<movies>
<movie>
<title>PHP: Behind the Parser</title>
<plot>So, this language. Its like, a programming language.</plot>
<rating type="thumbs">7</rating>
<rating type="stars">5</rating>
</movie>
</movies>
</soap:Body>
</soap:Envelope>
XML;
$ns = "http://schemas.xmlsoap.org/soap/envelope/";
$xml = new SimpleXMLElement($xmlstr);
$body = $xml->children($ns);
$library = $body->children(NULL);
echo $library->movies->movie[0]->rating[0]->attributes()->type; // thumbs
echo $library->movies->movie[0]->plot; // the plot
?>
----
Server IP: 83.64.128.68
Probable Submitter: 83.13.242.82
----
Manual Page -- http://www.php.net/manual/en/ref.simplexml.php
Edit -- https://master.php.net/note/edit/75443
Del: integrated -- https://master.php.net/note/delete/75443/integrated
Del: useless -- https://master.php.net/note/delete/75443/useless
Del: bad code -- https://master.php.net/note/delete/75443/bad+code
Del: spam -- https://master.php.net/note/delete/75443/spam
Del: non-english -- https://master.php.net/note/delete/75443/non-english
Del: in docs -- https://master.php.net/note/delete/75443/in+docs
Del: other reasons-- https://master.php.net/note/delete/75443
Reject -- https://master.php.net/note/reject/75443
Search -- https://master.php.net/manage/user-notes.php