# Is there a better way to find the XML node which has a specific attribute?

**URL:** <https://forum.kirupa.com/t/is-there-a-better-way-to-find-the-xml-node-which-has-a-specific-attribute/323312>\
**Category:** flash\
**Created:** [June 24, 2011, 8:09pm UTC](https://forum.kirupa.com/t/is-there-a-better-way-to-find-the-xml-node-which-has-a-specific-attribute/323312 "2011-06-24T20:09:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![m2244](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@m2244](https://forum.kirupa.com/u/m2244)\
**Post date:** [June 24, 2011, 8:09pm UTC](https://forum.kirupa.com/t/is-there-a-better-way-to-find-the-xml-node-which-has-a-specific-attribute/323312/1 "2011-06-24T20:09:14Z")

</div>

I have a series of XML nodes that are the same (except for the data of course). I want to find the node with that attribute and use that node’s data. I know I can do this with a for loop and an if statement but I was hoping that there was a better way.

In the XML below I need to find the node with the correct ‘fileName’ attribute.

Any ideas?

```auto

  <decisionPoint fileName="asdf">
    <choice label="1" goTo="dfd"/>
    <choice label="2" goTo="fsdfw3"/>
  </decisionPoint>
  <decisionPoint fileName="dfd">
    <choice label="22" goTo="asdf"/>
    <choice label="33" goTo="fsdfw3"/>
  </decisionPoint>
  <decisionPoint fileName="fsdfw3">
    <choice label="222" goTo="dfd"/>
    <choice label="111" goTo="asdf"/>
  </decisionPoint>

```
