[jdom-interest] Validation error on valid XML
    Joseph Bowbeer 
    jozart at csi.com
       
    Wed Dec 12 19:01:24 PST 2001
    
    
  
Are you reusing SAXBuilder?  Try creating a new SAXBuilder every time you
parse and see if the problem goes away.
SAXBuilder and/or the underlying XML parser may not be cleaning up after an
error, or resetting completely at the beginning of every build.
--- original message ---
I have a strange problem.
1) First, I validate a document that is well formed and the validation comes
out fine (no errors).
2) Next, I submit an invalid document and the parser throws the correct
exception.
3) Finally, I correct my document back to what is was in number 1, but now I
get a new error message (not the one from step 2).
If I restart the servlet (which contains the validation code), everything is
OK again (valid documents don't throw an error message).
Anyway, here is my code:
try {
   SAXBuilder builder = new SAXBuilder();
   builder.setValidation(true);
   StringReader xmlreader = new StringReader(xml);
    Document doc = builder.build(xmlreader);
   }
   catch (JDOMException e) {
    System.out.println("Validating exception: " + e);
   }
Does anyone know what is going on?  Any help would be greatly appreciated!
-carl jensen
    
    
More information about the jdom-interest
mailing list