Re: [Flashcoders] Searching within XML
I think, it is not available at the moment. I'll send you the AS2 sources offlist. hth, Matthias 2007/7/25, Omar Fouad <[EMAIL PROTECTED]>: 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 > -- Omar M. Fouad - Digital Emotions http://www.omarfouad.net +2010 - 2346633 - +2012 - 261 ___ 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
Re: [Flashcoders] Searching within XML
Omar Fouad wrote: com.xfactorstudio.xml.xpath??? where can i get it??? Well, XPath is just one way of searching through an XML document to get specific nodes. As you might guess from the package name, this particular implementation can be found at www.xfactorstudio.com . You can learn more about XPath itself at W3Schools, or from reading the official specification. Google will give you more links than I can, and faster. If you're working with XML even a little, XPath is worth learning. It's like regular expressions -- a specialized little tool that can make very tedious things extremely easy. ___ 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
Re: [Flashcoders] Searching within XML
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
Re: [Flashcoders] Searching within XML
It is hardy much more work to parse the XML manually. We did a complex search (find me all the things that a fireman might use for personal protection during an earthquake or what respirators are used by first responders or what headgear does the police marine unit wear) without XPath. Just travelled through the XML tree and applied the search criteria. We used XML to pass the search criteria as well. Nice separation between the user interface (responsible for building the search criteria) and the search engine (responsible for applying the search criteria to the XML database) It appears that this code uses XPath to find the subtree of interest and then navigates the subtree. XPath certainly makes it clearer if the tree is complex with lots of sub-trees that are not involved in the search. You get right to the root of the tree of interest. Ron Alan MacDougall 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
Re: [Flashcoders] Searching within XML
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 -- Omar M. Fouad - Digital Emotions http://www.omarfouad.net +2010 - 2346633 - +2012 - 261 ___ 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
Re: [Flashcoders] Searching within XML
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] Searching within XML
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? Regards -- Omar M. Fouad - Digital Emotions http://www.omarfouad.net +2010 - 2346633 - +2012 - 261 ___ 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] Searching within XML
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? Regards -- Omar M. Fouad - Digital Emotions http://www.omarfouad.net +2010 - 2346633 - +2012 - 261 ___ 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