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:Hea der/><soap env:Body>< soap:login username="username" password="password"/></soa penv:Body> </soapenv: Envelope>' );
var SearchRequestXML:XML = new XML(XMLString);
//Create the container for the response
var responseXML:XML = new XML();
SearchRequestXML.sendAndLo ad(serverU RL, 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:loginR esponse xmlns:ns2="http://www.oakapple.somedomain.com/soap/"><data sessionToken="934d1c717c8c 7dca01fdf9 8269158d46 " email="test123" mobile="test123" lastname="test123" firstname="test123" /></ns2:loginResponse></so ap:Body></ soap:Envel ope>
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].childN odes[0].ch ildNodes;
I can now trace this:
<data sessionToken="c81930a0396a a9122226c1 7c7daba775 " email="test123" mobile="test123" lastname="test123" firstname="test123" />
but am still having problems getting the values from this piece.
thanks
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:Hea
var SearchRequestXML:XML = new XML(XMLString);
//Create the container for the response
var responseXML:XML = new XML();
SearchRequestXML.sendAndLo
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><
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].
I can now trace this:
<data sessionToken="c81930a0396a
but am still having problems getting the values from this piece.
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.