I am moving onto the next phase in my project. I want to parse an XML file and use the elements in it to populate a graphic in Dashboard.
I have mixed and matched code from all over to attempt to accomplish this but no luck.
Can nyone spot an obvious error in the cryptic code ? Or suggest another approach?
var filepath = ogscript.getPrivateString('constants','filepath');
var XMLDoc;
ogscript.debug('Reading XML file: ' );
XMLDoc = ogscript.parseXML('file:/H:/CCHL2019/Sportzcast/ScoreBoardHD2.xml'); // this line reads in the XML file, XMLDoc is set null on failure
if (XMLDoc == null) {
ogscript.debug('Failed to read file');
} else {
ogscript.debug('Parsing XML');
var found=XMLDoc.getElementsByTagName('info'); // this line creates a nodeList
ogscript.debug('search found ' + found.length + ' items');
for (var i = 0; i < found.length; i++) { // for each item in the node list...
var node = found.item(i);
var first = node.getAttribute('site');
var name = children.item(i).firstChild.nodeValue // and the next will have the name data.
// ogscript.debug(i + ": " + name + ", " + first);
//params.setValue(teamList, i, name);
// params.setValue(0x3, i, Number(num));
}
}
Thanks
Whit