Link to home
Start Free TrialLog in
Avatar of palpsdelux
palpsdelux

asked on

More xml parsing in actionscript 2

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
ASKER CERTIFIED SOLUTION
Avatar of moagrius
moagrius
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial