Skip to main content
Participant
April 10, 2014
Question

How can I specify a namespace to use with XML::child() ? None of XML::useNamespace(), default xml na

  • April 10, 2014
  • 1 reply
  • 391 views

How can I specify a namespace to use with XML::child() ?

None of XML::useNamespace(), default xml namespace, and use namespace seem to work. Only E4X. But I want to use XML::child()

This topic has been closed for replies.

1 reply

Inspiring
April 11, 2014

It seems the only way to use namespace with child() method is to pass QName instance as an argument.

For example:

var xml:XML =

          <xml xmlns:ns1="http://www.example.com/uri/" xmlns:ns2="http://www.example.com/uri2/">

                    <ns1:childNode value="ns1 attr value">NS1 Node Value</ns1:childNode>

                    <ns1:childNode value="ns1 attr value 2">NS1 Node Value 2</ns1:childNode>

                    <ns2:childNode value="ns2 attr value">NS2 Node Value</ns2:childNode>

          </xml>;

var xplNs:Namespace = new Namespace("http://www.example.com/uri/");

trace(xml.child(new QName(xplNs, "childNode")));