troubleshooting Question

More xml parsing in actionscript 2

Avatar of palpsdelux
palpsdelux asked on
Adobe Flash
1 Comment1 Solution351 ViewsLast Modified:
Hi,
I have some code that is successfully sending a request to a server and getting a response in the form of some xml.  what I'm now trying to do is extract the bits of data from the return to use in my app.  The code thus far is:



var serverURL = 'http://someserver/oakapple/Addy';

XMLString = ('<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://www.oakapple.somdomain.com/soap/"><soapenv:Header/><soapenv:Body><soap:login username="username" password="password"/></soapenv:Body></soapenv:Envelope>');

var SearchRequestXML:XML = new XML(XMLString);

//Create the container for the response
var responseXML:XML = new XML();

SearchRequestXML.sendAndLoad(serverURL, responseXML);

function onLoaded(){
trace(responseXML);
}


responseXML.onLoad = onLoaded;

Now, running the above code gives me an expected trace of this:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:loginResponse xmlns:ns2="http://www.oakapple.somedomain.com/soap/"><data sessionToken="934d1c717c8c7dca01fdf98269158d46" email="test123" mobile="test123" lastname="test123" firstname="test123" /></ns2:loginResponse></soap:Body></soap:Envelope>

So what I want to do now is get the values in the above mentioned return.

Many thanks


//*********************** Updated

Using this code:

xml1 = responseXML.childNodes[0].childNodes[0].childNodes[0].childNodes;

I can now trace this:

<data sessionToken="c81930a0396aa9122226c17c7daba775" email="test123" mobile="test123" lastname="test123" firstname="test123" />

but am still having problems getting the values from this piece.
thanks
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 1 Comment.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros