Skip to content
richardszalay edited this page May 20, 2011 · 9 revisions

Creates an observable sequence that loads and parses XML

static function xml(request:URLRequest, 
    loaderContext:LoaderContext = null) : IObservable.<XML>

Remarks

The returned sequence emits the XML and completes after it loads successfully.

The returned sequence returns an error if there is a SecurityError or IOError loading the content, or if there is an error parsing the XML.

Return Value

IObservable.<XML>

Examples

namespace atom = "http://www.w3.org/2005/Atom";

var raixWikiFeedURL : URLRequest = 
    new URLRequest("http://wiki.github.com/richardszalay/raix/wikis.atom");

var latestRaixWiki : IObservable = Observable.xml(raixWikiFeedURL)
    .map(String, function(feed : XML) : String
    {
        use namespace atom;

        return feed.entry[0].title.toString();
    });

latestRaixWiki.subscribe(function(entryTitle : String) : void
    {
        trace("The latest raix wiki page updated was: " + entryTitle);
    });

    // Trace output is:
    // The latest raix wiki page updated was: xml
Clone this wiki locally