Google??? or try guessing from the name.

Omar Fouad wrote:
com.xfactorstudio.xml.xpath??? where can i get it???

On 7/25/07, Alan MacDougall <[EMAIL PROTECTED]> wrote:

Omar Fouad wrote:
> I am doing some application on flash that uses an XML file to store
> data...
> This application has a search form. I understand how to get through
> the xml
> by loops but i can't figure out how to get flash to know if this
> "word" is
> included within the xml nodes or not... Any simple idea?
The steps would be something like this:

1. get all the nodes which might contain the word (probably as an array)
2. loop through the array, getting the string from each text node
3. use String.strpos to see if the word is present.

Which step is giving you trouble? My code would look something like this:

import com.xfactorstudio.xml.xpath.*;

function findInXML(rootNode:XMLNode, target:String):Boolean
{
    var nodeArray:Array = XPath.selectNodes(rootNode, "xpathQuery");

    for (var i:Number = 0; i < nodeArray.length; i++)
    {
       if (nodeArray[i].nodeValue.strpos(target) != -1)
       {
          return true;
       }
    }
}

And there you go. The XPath query would be something like
"parentNode/childNode/text()".

_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com




_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to