I have an XML string in which Val.responseText gives me
<NewDataSet>
<Table>
<FieldID>21</FieldID>
<TableName>F003v001</TableName>
<FieldName>Grade</FieldName>
<DisplayField>Grade</DisplayField>
<FieldType>text</FieldType>
</Table>
</NewDataSet>
I'm calling FillTable(sVal.responseXML.documentElement);
function FillTable(sResponse) {
var preXML = sResponse;
// code for IE
if (window.ActiveXObject) {
var doc = new ActiveXObject("Microsoft.XMLDOM");
doc.async = "false";
doc.loadXML(preXML);
}
// code for Mozilla, Firefox, Opera, etc.
else {
var parser = new DOMParser();
var doc = parser.parseFromString(preXML, "text/xml");
}
// documentElement always represents the root node
var x = doc.documentElement;
}
Now I want to parse through each of the node and populate a datagrid. Can anyone help me parse through the nodes?
How do i get the values for fieldid, tablename, displayfield?
I tried NodeList = doc.documentElement.selectNodes("Table") but nodelist.length gives me zero.