2

say I have XML like this:

<root>
  <x:Item>test</x:Item>
</root>

How would I navigate to the x:Item node?

I tried myXml..x:Item and myXml..x::Item but both throw errors. The first won't compile and the second complains about me trying to use NameSpace '0'.

3
  • 3
    That's a namespace. Who stole your namespace declarations? Commented Mar 7, 2011 at 22:44
  • @bmargulies, it had to do with namespaces as you suspected. If you post as an answer I'll accept. Commented Mar 7, 2011 at 22:55
  • No need. I don't know actionscript. Commented Mar 7, 2011 at 23:24

2 Answers 2

4

I ended up adding the namespace to my XML in my actionscript and that solved the issue. You can find the documentation here. The coded endedup looking like this:

var wNS:Namespace = new Namespace("w", "http://www.test.com/weather/");
myXmlMessage.addNamespace(wNS);
Sign up to request clarification or add additional context in comments.

1 Comment

+1 for following up and documenting the answer to your own question. Someone else will have the same question and see how to register namespaces in their actionscript.
0

Just on top of my head...

myXML[0].Item

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.