I am generating an XML string with javascript as such:
Code: Select allvar xml = "<object>";
xml += '<property id="labName">';
xml += "<string>";
xml += "My Lab Name";
xml += "</string>";
xml += '</property>';
xml += "</object>";
return xml;
When tested with an alert it comes back as expected. My question is how do I get that XML string into an ArrayCollection. Thanks for any insight you may have.
Processing XML returned by javascript
Processing XML returned by javascript
I thought I posted a reply to this, but I guess I got distracted. It appears that while an alert brings up what you think is XML, it's not constructed as proper xml.
You need to use:
Code: Select allvar xml = new XML()
xml = XML('<root><someNodeName someAttribName="theName"><item/></someNodeName></root>')
Then you want to add items by appending them:
Code: Select allxml.someNodeName.appendChild(XML('<item><your info here></item>'))
To put the xml into an array, you need to construct a for loop:
Code: Select allvar yourArray = new Array()
for(var i = 0;i<xml.someNodeName.children().length();i++){
yourArray = xml.someNodeName.children()
}
Not sure if I used all the right stuff here, but you need to use the syntax designed for XML as described in the ESTK guide.
You need to use:
Code: Select allvar xml = new XML()
xml = XML('<root><someNodeName someAttribName="theName"><item/></someNodeName></root>')
Then you want to add items by appending them:
Code: Select allxml.someNodeName.appendChild(XML('<item><your info here></item>'))
To put the xml into an array, you need to construct a for loop:
Code: Select allvar yourArray = new Array()
for(var i = 0;i<xml.someNodeName.children().length();i++){
yourArray = xml.someNodeName.children()
}
Not sure if I used all the right stuff here, but you need to use the syntax designed for XML as described in the ESTK guide.