Dynamic XML Validation with JAVA
Posted on 2006-10-25
I'm trying to figure out a way to dynamically validate an XML Dom object. For example I want to be able to load an XML file in to a Document object then manipulate the structure of that object in memory. Each time I make changes to the object by adding or removing elements I would like the object to be re-validated against the DTD to make sure it's still valid. When the structure becomes invalid I want error messages generated.
I know I can validate the DOM object when the Document object gets generated but I want to be able to keep the object valid as it's manipulated.
Any help here would be appreciated, some example code would be helpful.