I can't seem to figure this one out. I have the following XML file:
<?xml version="1.0" encoding="UTF-8"?>
<targets>
<showcases>
<building name="Big Blue" />
<building name="Shiny Red" />
<building name="Mellow Yellow" />
</showcases>
</targets>
I need to be able to test whether or not a
node exists with a given name. Everything I seem to find on Google tells me to do something like the following:<building>
$xdoc->getElementsByTagName('building')->item(0)->getAttributeNode('name')
... but if I understand that correctly, doesn't that only test the first <building>
node? item(0)
? Do I need to use XQuery for this?
I'd appreciate some help! Thanks!