Hi,

I'm trying to validate XML files via a DTD and using a catalog to resolve entities to a local copy of the DTD. The code is working in Java 1.6 but throws an IOException in Java 1.5 and via the stacktrace it seems that the code is trying to access the local DTD using the ftp protocol.

This is the code:

        String[] catalogs = {"lib/catalogs/catalog.xml"};
        XMLCatalogResolver resolver = new XMLCatalogResolver();
        resolver.setCatalogList(catalogs);
XMLReader parser = XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");
        parser.setFeature("http://xml.org/sax/features/validation";, true);
parser.setProperty("http://apache.org/xml/properties/internal/entity-resolver ", resolver);
        parser.setErrorHandler(new HachetteParseErrorHandler());
InputSource inputSource = new InputSource(new FileInputStream(inputFilePath));
        parser.parse(inputSource);

Here is the stacktrace:

java.io.IOException: Server returned HTTP response code: 503 for URL: 
ftp://Users/jeffsese/Java%20Projects/Hachette%20EPub%20Conversion/lib/dtd-schemas/DTD_LG_XMLV3_1.DTD
at sun .net .www .protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java: 1170) at sun .net .www .protocol.ftp.FtpURLConnection.getInputStream(FtpURLConnection.java:356) at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
        at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
at org.apache.xerces.impl.XMLEntityManager.startDTDEntity(Unknown Source) at org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(Unknown Source) at org.apache.xerces.impl.XMLDocumentScannerImpl $DTDDispatcher.dispatch(Unknown Source) at org .apache .xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at com .asiatype .hachette .epubconversion .xmlvalidation .HachetteXMLValidation.validate(HachetteXMLValidation.java:47) at com .asiatype .hachette .epubconversion .xmlvalidation.HachetteXMLValidation.main(HachetteXMLValidation.java:79)

catalog.xml:
<?xml version="1.0" encoding="UTF-8"?>
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="public"> <system systemId="DTD_LG_XMLV3_1.DTD" uri="../dtd-schemas/ DTD_LG_XMLV3_1.DTD" />
</catalog>

is there a compatibility issue between the two versions of Java when using the XMLCatalogResolver?

I'm using Xerces 2.9.1 in Mac

Thanks in advance,
-- Jeff

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
For additional commands, e-mail: j-users-h...@xerces.apache.org

Reply via email to