What would be the best way to determine if an XMLList contains a specific node and if that node contains any text or contains a specific attribute?
This is probably a stupid question, but I think i’m doing it all wrong…
if(myXML.nodeName) { return true; } // returns true even if it contains no content
if(myXML.@attributeName) { return true; } // returns true even if the attribute is empty or doesent exist
For example how would you determine the following:
<items>
<item></item> // does item contain text?
<item val="1">cheesecake</item> // does item containt attribute val1?
</items>
<items> // does node "items" contain an "item"?
</items>