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=16584>.
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=16584

NPE when parsing any file with DTD and dynamic  validation enabled

           Summary: NPE when parsing any file with DTD and dynamic
                    validation enabled
           Product: Xerces2-J
           Version: 2.3.0
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: Other
         Component: SAX
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


I am getting following exception with xerces 2.3 while parsing any xml file 
with DTD and http://apache.org/xml/features/validation/dynamic"; feature set
To reproduce please see sample code below. You can run it agains personal.xml 
from xerces distribution. What's interesting is that when validation is 
explicetly enabled via parserFactory.setValidating(true); I do not get this 
exception

Exception in thread "main" java.lang.NullPointerException
        at org.apache.xerces.impl.dtd.XMLDTDValidator.validateDTDattribute
(Unknown Source)
        at 
org.apache.xerces.impl.dtd.XMLDTDValidator.addDTDDefaultAttrsAndValidate
(Unknown Source)
        at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement
(Unknown Source)
        at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown 
Source)
        at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement
(Unknown Source)
        at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.
dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument
(Unknown Source)
        at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
        at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at Parse.main(Parse.java:21)

import org.xml.sax.XMLReader;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

public class Parse {

  public static void main(String[] args) throws Exception {
    SAXParserFactory parserFactory = SAXParserFactory.newInstance();
    parserFactory.setValidating(true); //uncomment and error will disappear
    parserFactory.setNamespaceAware(true);
    SAXParser parser = parserFactory.newSAXParser();
    XMLReader reader = parser.getXMLReader();
    reader.setFeature("http://apache.org/xml/features/validation/dynamic";, 
true);
    reader.parse(args[0]);
  }

}

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

Reply via email to