I am trying to use the javax.xml.xpath package to run XPath expressions on a document with multiple namespaces, and I\'m having goofy performance problems.
My test d
Try cloning the node (so you won't have unnecessary references from its ancestors)
Node singleNode = nodes.item(i).cloneNode(true);
If you remove children, you will lose references and only get half of the nodes you want to process.