XPath in Flash
Flash+xml. Explicació® ¤e como elegir en un nodo concreto,un hijo concreto.
*Noticí¡ en Ingl鳬 extraí¤¡ de peterjoel.com
Recently I have started using XPath to extract data from XML documents, rather than navigating the parsed XML object directly with firstChild, nextSibling etc. Neeld Tanksley, of XFactor Studio has written a near complete implementation of XPath 1.0, which lets you do complex queries to find the node you are after. Searching XML with XPath is more powerful than, for example, than searching a database with sql, because of the huge range of standard functions that you can use within your query.
Neeld has a XPath tester app on his homepage so you can have a play with different queries on the sample document.
Here is a quick example, which searches my blog’s rss feed for a post, whose title and description both contain the word “class”, and returns the description:
import com.xfactorstudio.xml.xpath.XPathDocument;
var x = new XPathDocument();
x.load(“http://www.peterjoel.com/blog/rss.php”);
x.onLoad = function(){
var query:String = “//item[contains(description,'class') and contains(title,'class')]/description”;
var nodes = this.selectNodes(query);
trace(nodes[0]);
}
um… buoni, realmente buoni luogo e molto utile;)