sharing small pieces of rocks or jewels I find on the way

XPath example

I have used XPath before, recently when I needed I forgot the syntax, so thought of keep it written here. It may come helpful for some others as well

import mx.xpath.XPathAPI;

var xml:XML = new XML();
xml.ignoreWhite = true;
xml.load(“http://api.flickr.com/services/feeds/photos_public.gne?id=67845814@N00&lang=en-us&format=rss_200″);

xml.onLoad = function()
{
    var thumbs:Array = XPathAPI.selectNodeList(this.firstChild, “/rss/channel/item/media:thumbnail”);
    for(var i in thumbs)
    {
        trace(thumbs[i].attributes.url);
    }
}

This tutorial was a great help.

http://tutorials.lastashero.com/2005/10/using_the_xpath_api_in_flash.html

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: