From the following code snippet I tried, This runs into an infinite loop regardless of the fact that I mark the initial ds as immutable, and looping it with an each. What am I missing? -
domObject.Whatever.'**'.findAll { it.name() == 'Node' }.asImmutable().each { node -> //Bazinga
nodes.split(/(;|,|\n|&)/).eachWithIndex { nodeName, index ->
def newNode = new Node(null, node.name(), node.attributes(), node.value())
newNode.@name = nodeName
//I'm simply adding new nodes here
node.parent().children().add(0, newNode) //bazinga
}
}
Ive used an xmlparser for the domObject.