please help me with the following problem.
the problem is in xml parsing my xml code is:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root type="object">
<codeListValue type="object">
<personnelCategory type="array">
<item type="string">Regular</item>
<item type="string">International</item>
<item type="string">Contractor</item>
<item type="string">System</item>
<item type="string">Employee</item>
</personnelCategory>
<pcImages type="array">
<item type="string">Windows</item>
<item type="string">Linux</item>
<item type="string">MAC OS</item>
<item type="string">Engineering Image</item>
</pcImages>
</codeListValue>
</root>
the parsing code is the same as that in web os sdk.The parsing part is here:
parseXML: function() {
this.items = [];
//this.path="/root";
this.url='Values.xml';
this.$.getGoogleResults.url = this.url;
this.$.getGoogleResults.call();
},
... ... gotResultsSuccess: function(inSender, inResponse) {
var xmlstring = inResponse;
var parser = new DOMParser();
var xmlobject = parser.parseFromString(xmlstring, "text/xml");
var nodes = document.evaluate('/root', xmlobject, null, XPathResult.ANY_TYPE, null);
var result = nodes.iterateNext();
//alert(result.textContent);
var i=0;
while(result)
{
this.items[i] = result.childNodes[0].nodeValue;
i++;
result=nodes.iterateNext();
}
this.items=result.textContent;
this.$.header.setContent(this.items);// [ this is a header component i have defined and i am setting its content here]
},
I am getting the result as Regular International contractor System ... Engineering image
the complete text content in the XML is getting diaplayed serially.how do i get individual nodes and child nodes.i am getting null values for all these.PLease help with some code examples.
Thanks :)