Forum Discussion
ArturoMartinez
12 years agoOccasional Contributor
Well, working all the weekend I have found some mistakes, now that I solved out them I find the following issue.
My "recursive" function to parse all the XML DOM tree doesn't works fine.
Here is the updated function:
The problem is that 'getNodeName()' always returns "#text", which obviously means that I'm moving wrong through the tree.
What should I change?
My "recursive" function to parse all the XML DOM tree doesn't works fine.
Here is the updated function:
public void parseNode(Node node, ArrayList list){
if (node.hasChildNodes())
{
def childrens = node.getChildNodes();
for (int i = 0; i < childrens.getLength(); i++)
parseNode(childrens.item(i), list);
}
else
addNewElement(node.getNodeName(), node.getNodeValue(), list);
}
The problem is that 'getNodeName()' always returns "#text", which obviously means that I'm moving wrong through the tree.
What should I change?