Jerome
04-03-2003, 10:28 AM
Hi,
Retrieving a xml-file and reading the nodeValues of the different Childs is working fine.
For future possibilities I added an id to every item.
My question is: how can I read-out the id-value of every item using the routine mentioned below?
Thanks for Your effort,
Jerome
XML-file:
<?xml version="1.0"?>
<PRODUCTS>
<ITEM id="206">
<MODEL>extra large</MODEL>
<YEAR>1990</YEAR>
</ITEM>
<ITEM id="207">
<MODEL>large</MODEL>
<YEAR>1991</YEAR>
</ITEM>
<ITEM id="208">
<MODEL>medium</MODEL>
<YEAR>1991</YEAR>
</ITEM>
<ITEM id="209">
<MODEL>small</MODEL>
<YEAR>2000</YEAR>
</ITEM>
</PRODUCTS>
Routine:
var cont=xmlDoc.documentElement.childNodes;
data="";
data+="<table>";
for(i=0;i<=cont.length-1;i++)
{
data+="<tr><td>ID-VALUE</td><td>"+cont[i].childNodes[k].text+"</td></tr>";
}
data+="</table>";
Retrieving a xml-file and reading the nodeValues of the different Childs is working fine.
For future possibilities I added an id to every item.
My question is: how can I read-out the id-value of every item using the routine mentioned below?
Thanks for Your effort,
Jerome
XML-file:
<?xml version="1.0"?>
<PRODUCTS>
<ITEM id="206">
<MODEL>extra large</MODEL>
<YEAR>1990</YEAR>
</ITEM>
<ITEM id="207">
<MODEL>large</MODEL>
<YEAR>1991</YEAR>
</ITEM>
<ITEM id="208">
<MODEL>medium</MODEL>
<YEAR>1991</YEAR>
</ITEM>
<ITEM id="209">
<MODEL>small</MODEL>
<YEAR>2000</YEAR>
</ITEM>
</PRODUCTS>
Routine:
var cont=xmlDoc.documentElement.childNodes;
data="";
data+="<table>";
for(i=0;i<=cont.length-1;i++)
{
data+="<tr><td>ID-VALUE</td><td>"+cont[i].childNodes[k].text+"</td></tr>";
}
data+="</table>";