1

I have the following XML object:

<ns2:errorCode>
  3001
</ns2:errorCode>

How do I access the value if I only have a string saying errorCode.

I would like to do something like:

xml['*::'+str] where xml is the XML object with the above node and str is my string variable containing "errorCode".

2 Answers 2

1

Thank you for the help. If anybody is interested this is how I solved it.

What was making the task difficult was the namespace. This works!

var t:XMLList = xml.*.(localName() =='errorCode');
Sign up to request clarification or add additional context in comments.

Comments

0

You may need to check how to traverse XML structures in ActionScript3:

http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7e6b.html

str = xml.errorCode shall do the trick.

1 Comment

Tip: take a look at the namespace part. You will need it.

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.