Send to a Friend

lefteh's avatar

How would I check if an XML element exists in PHP?

Asked by lefteh (9429points) January 28th, 2009

Sorry guys. Same script, different problem. Google is no help.

Here is the script.

The script pulls out the “when” element and its attributes. The problem is that not every entry has a when element. How can I skip these records? I am aware of a hasAttribute function, but I can’t seem to find any equivalent for elements. I’ve played around with several techniques, and nothing has worked.

If these entries are not skipped, the following error occurs:
Fatal error: Call to a member function getAttributeNode() on a non-object

Thanks again..

Using Fluther

or

Using Email

Separate multiple emails with commas.
We’ll only use these emails for this message.