posted 18 years ago
I'm facing a problem for which I am unable to find a correct solution. I have a XML file which I read into memory and make a DOM (using validating parser). Now I start removing certain nodes from the DOM. I want to check that each Node removal is not causing the document to be invalid against the DTD. I want to check this as and when i'm removing the nodes and if the document is becoming invalid because of theremoval then I do not want to remove the node. The only way I can think of achieving that right now is removing each node then writing the file back and again validating it by parsing through a validating parser. But that will hit the performance a lot. Can anyone suggest a better alternate, I'm sure they would be a better way.
Thanks in advance.
Nitin