XML parsing

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ginocyber
Forum Newbie
Posts: 4
Joined: Wed Sep 15, 2010 11:35 am

XML parsing

Post by ginocyber »

Hi everyone,

How would I parse for the section information="info_2" from the data_1 tag

<?xml version="1.0" encoding="utf-16"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://nowhere.com/wsdl"><soap:Body><response status="complete" version="46" resource_type="data_1" ns="username" op_type="get_data">
<data_1 id="ID 1" information="info_2" ip_address="info_3" />
</response></soap:Body></soap:Envelope>

?>

Thanks

GC
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: XML parsing

Post by Jonah Bron »

Code: Select all

$xml->documentElement->getElementsByTagName('data_1')->item(0)->getAttribute('information');
ginocyber
Forum Newbie
Posts: 4
Joined: Wed Sep 15, 2010 11:35 am

Re: XML parsing

Post by ginocyber »

Thanks Jonah.

That did the trick.
Post Reply