Reputation: 572
I want to do something like your standard XML E4X attribute check to return an XMLList of results:
myXml.someGroup.someItem.(@someAttribute == myVar)
Is there a way to do this when @someAttribute doesn't always exist? It's okay if I skip items without the attribute in my search.
Thanks.
Upvotes: 1
Views: 143
Reputation: 2885
Yes, you could check for property before access it:
myXml.someGroup.someItem.(hasOwnProperty("@someAttribute") && @someAttribute == myVar)
Upvotes: 1