# Determine if XMLNode exists or is empty?

**URL:** <https://forum.kirupa.com/t/determine-if-xmlnode-exists-or-is-empty/241803>\
**Category:** flash\
**Created:** [October 18, 2007, 9:05am UTC](https://forum.kirupa.com/t/determine-if-xmlnode-exists-or-is-empty/241803 "2007-10-18T09:05:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mistykal](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@Mistykal](https://forum.kirupa.com/u/Mistykal)\
**Post date:** [October 18, 2007, 9:05am UTC](https://forum.kirupa.com/t/determine-if-xmlnode-exists-or-is-empty/241803/1 "2007-10-18T09:05:13Z")

</div>

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…

```auto
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:

```auto
  <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>

```
