One of them days today
Can someone show why the following XML:
Doesn't render correctly please.
I'm running this code which seems to 'pop-up' all over the place for traversing XML files.
(Yes I know I'm not getting the attribute "text", I can cover that later, but it's still not rendering the correct child nodes, as if it's omitting the last one per child)
Totally stumped.
Can someone show why the following XML:
Code:
<?xml version="1.0" encoding="us-ascii" ?>
<node text="Top" parentID="0">
<node text="Spirits" parentID="" tag="1">
<node text="Brandy" parentID="1" tag="B">
<node text="Cognac / Armagnac" parentID="B" tag="10">
<node text="Cognac" parentID="10" tag="23" />
<node text="Armagnac" parentID="10" tag="8" />
</node>
<node text="Other Brandy" parentID="B" tag="19">
<node text="Grape Brandy" parentID="19" tag="162">
<node text="Other Grape Brandy" parentID="162" tag="125" />
</node>
<node text="Grape EDV" parentID="19" tag="164">
<node text="Fine (EDV)" parentID="164" tag="92" />
<node text="Grappa" parentID="164" tag="34" />
<node text="Singani" parentID="164" tag="105" />
<node text="Pisco" parentID="164" tag="102" />
<node text="Marc / Lie" parentID="164" tag="100" />
</node>
</node>
</node>
</node>
</node>
Doesn't render correctly please.
I'm running this code which seems to 'pop-up' all over the place for traversing XML files.
Code:
function loadXML(xmlFile)
{
xmlDoc.async="false";
xmlDoc.onreadystatechange=verify;
xmlDoc.load(xmlFile);
}
function verify()
{
if(xmlDoc.readyState!=4)
return false;
}
function traverse(tree) {
if(tree.hasChildNodes()) {
document.write('<ul><li>');
document.write('<b>'+tree.tagName+' : </b>');
var nodes=tree.childNodes.length;
for(var i=0; i<tree.childNodes.length; i++)
traverse(tree.childNodes(i));
document.write('</li></ul>');
}
else
document.write(tree.text);
}
function initTraverse(file)
{
loadXML(file);
var doc=xmlDoc.documentElement;
traverse(doc);
}
(Yes I know I'm not getting the attribute "text", I can cover that later, but it's still not rendering the correct child nodes, as if it's omitting the last one per child)
Totally stumped.