# Use E4X to find Element of Unknown depth by attribute

**URL:** <https://forum.kirupa.com/t/use-e4x-to-find-element-of-unknown-depth-by-attribute/329759>\
**Category:** flash\
**Created:** [October 12, 2012, 5:58am UTC](https://forum.kirupa.com/t/use-e4x-to-find-element-of-unknown-depth-by-attribute/329759 "2012-10-12T05:58:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thinker2501](https://avatars.discourse-cdn.com/v4/letter/t/e0b2c6/32.png) [@Thinker2501](https://forum.kirupa.com/u/Thinker2501)\
**Post date:** [October 12, 2012, 5:58am UTC](https://forum.kirupa.com/t/use-e4x-to-find-element-of-unknown-depth-by-attribute/329759/1 "2012-10-12T05:58:16Z")

</div>

I have an XML object where all nodes have an ‘id’ attribute. I would like to search the entire XML object for a node of a given id regardless of the level or element name. I attempted:

```auto

var id:Number = 3 //Some passed value
var element:XMLList = myXml.descendants().(attribute('id') == id)); 

```

However this is returning nothing when I know there is a matching element in the XML somewhere. Any advice?
