DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17330>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17330

DocumentBuilder behaves incorrect after parse error

[EMAIL PROTECTED] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |
            Version|2.3.0                       |2.4.0



------- Additional Comments From [EMAIL PROTECTED]  2003-07-11 08:38 -------
Apparently, this was not entirely fixed in 2.4.0. The first repro (schema
violation) worked OK in 2.4.0, but if you have an invalid comment, you get the
same problem in 2.4.0 again. Attaching a new repro for this (repro2.zip),
reopening bug, setting version to 2.4.0. 

Slightly modified test code for the new file names:

    DocumentBuilderFactory dbf;
    DocumentBuilder db;
    Document d;
    
    dbf = DocumentBuilderFactory.newInstance();
    dbf.setNamespaceAware(true);
    dbf.setValidating(true); 
    dbf.setAttribute("http://apache.org/xml/features/validation/dynamic";,
                    new Boolean(true));
    dbf.setAttribute("http://apache.org/xml/features/validation/schema";, 
                     new Boolean(true));
    db = dbf.newDocumentBuilder();
    db.setErrorHandler(new XmlErrorHandler());

    d = db.parse(new File("AuftragDefinition.xml"));
    
    try {
      d = db.parse(new File("AngebotDefinition.xml"));
    } catch(Exception ex) {
      System.out.println("Catching expected exception.");
    }
    
    d = db.parse(new File("AuftragDefinition.xml"));


------------------------------------------------------------

  public static class XmlErrorHandler implements org.xml.sax.ErrorHandler
  {    
    public void warning(org.xml.sax.SAXParseException sAXParseException) throws 
org.xml.sax.SAXException {
    }
    
    public void error(org.xml.sax.SAXParseException sAXParseException) throws 
org.xml.sax.SAXException {
      throw new org.xml.sax.SAXException("Error at " + 
sAXParseException.getLineNumber() + "/" + sAXParseException.getColumnNumber()  
+ ": " + sAXParseException.getMessage());
    }
    
    public void fatalError(org.xml.sax.SAXParseException sAXParseException) 
throws org.xml.sax.SAXException {
      throw new org.xml.sax.SAXException("Fatal Error at " + 
sAXParseException.getLineNumber() + "/" + sAXParseException.getColumnNumber()  
+ ": " + sAXParseException.getMessage());
    }    
  } // XmlErrorHandler

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to