My question is related to the answer given by Sean Reilly to the question:
Use Groovy to Sort XML File
When I replace there
rootNode.children().sort(true) {it.attribute('name')}
with
rootNode.Person.sort(true) {it.attribute('name')}
the Person nodes aren’t sorted by their name attribute anymore. Why is that? When I compare rootNode.children()
with rootNode.Person
for equality true is returned. I am working with Groovy version 2.4.21.
I expect that in both cases the Person nodes are sorted.
jimmy_blue is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.