note 75443 deleted from ref.simplexml by tularis

From: Date: Wed, 30 May 2007 12:18:09 +0000
Subject: note 75443 deleted from ref.simplexml by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-127030@lists.php.net to get a copy of this message
Note Submitter: Marcio Annunciato Reason: useless ---- 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 ?>

« previous php.notes (#127030) next »