I have an XML document structured like this:
<produkter>
<produkt>
<forhandler></forhandler>
<produktnavn></produktnavn>
and so on...
</produkt>
</produkter>
I am pulling out data like this:
$produktnavn = utf8_decode($xmlObject->item($i)->getElementsByTagName('produktnavn')->item(0)->childNodes->item(0)->nodeValue);
Now I am looking to do a check to see if the node is present in the XML document at all.
For example... I only want to make the operation above if there actually IS a node called "produktnavn".
I am trying with:
if (isset($xmlObject->item($i)->forhandler)) {
But this doesn't seem to work.
What an I doing wrong?