E4X with XML namespaces
The Namespace class works with XML namespaces in ActionScript 3.0 and there are two way to define namespaces for working with XML.
var myXML:XML = <foo:order xmlns:foo = "http://www.example.com/foo"> <foo:book ISBN="0942407296" xmlns:bar = "http://www.example.com/bar"> <bar:title>The Book</bar:title> <foo:pageCount>238</foo:pageCount> </foo:book> </foo:order>;
var foo:Namespace = myXML.namespace("foo"); var bar:Namespace = myXML.foo::book.namespace("bar");The namespaces can be defined with the constructor of Namespace class if you already know the URIs of them.
var foo:Namespace = new Namespace("foo", "http://www.example.com/foo"); var bar:Namespace = new Namespace("bar", "http://www.example.com/bar");