Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

New Here ,
Apr 10, 2014 Apr 10, 2014

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()

TOPICS
ActionScript
362
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 10, 2014 Apr 10, 2014
LATEST

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")));

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines