Jump to content

php & parsing XML


blundell

Recommended Posts

Hi guys,

 

Been using this tutorial http://www.kirupa.com/web/xml_php_parse_intermediate.htm

 

all working well, however it only shows how to gather info from tags ie:

 

$xml_headline_key = "*NEWS*STORY*HEADLINE"; 

 

what if i wanted only HEADLINE tags with a certain attribute  i.e headline tag with id = 1:

<?xml version="1.0"?>
<news>
<story>
<headline> Godzilla Attacks LA! </headline>
<headline id = "1"> The Monster Arrives</headline>
<description>Equipped with a Japanese Mind-control device, the giant monster has attacked important harbours along the California coast. President to take action. </description>
</story>
</news>

 

Something like this:

$xml_headline_key = "*NEWS*STORY*HEADLINE[@id="1"]; 

 

maybe? or if not what keywords should I use in google?

 

Thanks guys

Link to comment
https://forums.phpfreaks.com/topic/126882-php-parsing-xml/
Share on other sites

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.