Just got started with eggplant and i want to parse some XML. I have been able to parse simpler XML using the senseTalk xmlParserScript.
I am trying a different method this time and the script works, but only for the first set of child nodes.
my XML looks like this:tnclTool_pointer tnclTool_eliminate tnclTool_highlighter tnclTool_pencil tnclTool_eraser tnclTool_notepad tnclTool_ruler tnclTool_protractor tnclTool_dot tnclTool_line tnclTool_compass tnclTool_pTable tnclTool_magnifier tnclTool_pointer tnclTool_eliminate tnclTool_highlighter tnclTool_pencil tnclTool_eraser tnclTool_notepad tnclTool_ruler tnclTool_protractor tnclTool_dot tnclTool_line tnclTool_compass
put file "C:\path_to_the_data_file\data.xml" as a tree into XMLSource set dataSet to XMLSource put node "tnLink" of dataSet into tnLinkNode put tnLinkNode's _attributes.path into testNavLink put dataSet's _children into itemList repeat with each item in itemList set itemNode to node item of itemList as tree put itemNode's _attributes.uin into itemUIN put itemNode's _children into toolList repeat with each toolImage in toolList put the text of toolImage into toolName put "toolName:" & toolName end repeat put end repeat
so it runs perfect for the first item
prints out the toolName’s as expected but then…
the error message:
24-May-12 12:42:35 FAILURE NSInternalInconsistencyException NSXMLElement.m:432 Assertion failed in NSXMLElement(instance), method insertChild:atIndex:. NSInvalidArgumentException
Execution Time 0:00:00 testNavToolsTest.script
seems to fail the second time this runs:
set itemNode to node item of itemList as tree
Im sure this is a total noob question. I hope someone can help!