cancel
Showing results for 
Search instead for 
Did you mean: 

E4X problem!

tonyc
Champ in-the-making
Champ in-the-making
I'm trying to write a script that takes pulls xml from a node's content and pulls out the values..  I've followed directions / recommendation from other posts but it seems as the e4x is not pulling any information from the xml..  I made a dumbed down the script for testing, it runs with no errors but the the content is null.

var string = "<root><tabledata><srid>14</srid></tabledata></root>";
var xmlData = new XML(string);
document.content = xmlData.root.tabledata.srid.toString();

Is there something i'm doing wrong? do i need to configure anything else? Im using community 3.2
1 REPLY 1

tonyc
Champ in-the-making
Champ in-the-making
If anyone is wondering, the problem was that I didn't need to specify the root element.

var string = "<root><tabledata><srid>14</srid></tabledata></root>";
var xmlData = new XML(string);
document.content = xmlData.tabledata.srid.toString();