# Searching for a string in an XML node

**URL:** <https://forum.kirupa.com/t/searching-for-a-string-in-an-xml-node/285778>\
**Category:** Uncategorized\
**Created:** [April 6, 2009, 12:59pm UTC](https://forum.kirupa.com/t/searching-for-a-string-in-an-xml-node/285778 "2009-04-06T12:59:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sci](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@sci](https://forum.kirupa.com/u/sci)\
**Post date:** [April 6, 2009, 12:59pm UTC](https://forum.kirupa.com/t/searching-for-a-string-in-an-xml-node/285778/1 "2009-04-06T12:59:12Z")

</div>

I have been experimenting with loading in xml in as3 (I followed the excellent Kirupa example [http://www.kirupa.com/developer/flashcs3/using\_xml\_as3\_pg1.htm](http://www.kirupa.com/developer/flashcs3/using_xml_as3_pg1.htm)) and so far so good.

I now want to check if a certain string is present in a particular node and if so run a certain action. For example:

say my xml has a node like so:

\<fruit\>  
\<apples\>  
\<item\>Customer likes Granny Smith, Winesap and Fuji apples\</item\>  
\</apples \>  
\</fruit\>

How can I check if a string is present in a node eg

nodeVal = displayData.fruit.apples\*;

if(nodeVal == “Granny Smith”){  
//perform certain action here  
}

Thanks for any help with this.
