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

referenced DTD not found when validating a XML document

           Summary: referenced DTD not found when validating a XML document
           Product: Xerces-J
           Version: 1.4.4
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: SAX
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


With the new version 1.4.4 I always encounter an exception when validating a XML 
document.

*Parsing Fatal Error*  Line:    0
  URI:     
  Message: File "signplus.dtd" not found.
org.xml.sax.SAXException: Fatal Error encountered
at 
de.softpro.signplus.client.businessModel.MyErrorHandler.fatalError(SB_XMLHandler
.java:2132)
        at 
org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1242)
        at 
org.apache.xerces.readers.DefaultEntityHandler.startReadingFromExternalEntity(De
faultEntityHandler.java:780)
        at 
org.apache.xerces.readers.DefaultEntityHandler.startReadingFromExternalSubset(De
faultEntityHandler.java:571)
        at 
org.apache.xerces.framework.XMLDTDScanner.scanDoctypeDecl(XMLDTDScanner.java:113
9)
        at 
org.apache.xerces.framework.XMLDocumentScanner.scanDoctypeDecl(XMLDocumentScanne
r.java:2145)
        at 
org.apache.xerces.framework.XMLDocumentScanner.access$0(XMLDocumentScanner.java:
2100)
        at 
org.apache.xerces.framework.XMLDocumentScanner$PrologDispatcher.dispatch(XMLDocu
mentScanner.java:831)
        at 
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java
:381)
        at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)

The XML document reverts to a DTD specification. The system id is NOT fully 
qualified:

<?xml version="1.0" encoding="Cp850"?>
<!DOCTYPE SignPlusEntry SYSTEM "signplus.dtd">
...

The problem only appears when passing the XML file as a stream to the parse 
methode of the XMLReader. When I pass the fully qualified URI of the XML file it 
works fine. It also works fine when I specifiy the fully qualified URI of the 
DTD within the XML file. So I assume that the reference to the DTD file is not 
resolved correctly when passing the InputSource object to the parse method. All 
this worked fine in version 1.4.3.

In the following I have listed parts of the code I use:

  public void readXML (java.io.InputStream xmlContent) {
    InputSource input=new InputSource(xmlContent);

    XMLReader parser = 
XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");
    parser.setContentHandler(new MyContentHandler());
    parser.setErrorHandler(new MyErrorHandler());

    // Turn on validation
    parser.setFeature("http://xml.org/sax/features/validation";, true);
    // Turn off namespace awareness
    parser.setFeature("http://xml.org/sax/features/namespaces";, false);

    // Parse the document
    parser.parse(input);

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

Reply via email to