-xcatalog option and deferred parsing don't play nice together

Jacob Kjome <[email protected]>
Newsgroups gmane.comp.java.enhydra.xmlc
Message-ID <[email protected]>
I just ran into a problem trying to load an XMLC class using deferred 
parsing where the metadata for the XML file specifies -xcatalog like this...

-xcatalog org/enhydra/barracuda/tutorials/xmlc/tutorials.xcat

Now, this compiles just fine.  The tutorials.xcat is found in the source 
path (and the dtd referenced in there is found just fine as 
well).  However, when the class is loaded using deferred parsing, I get the 
following error...

java.io.FileNotFoundException: 
C:\WINDOWS\system32\org\enhydra\barracuda\tutorials\xmlc\tutorials.xcat 
(The system cannot find the path specified)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(FileInputStream.java:106)
	at java.io.FileInputStream.<init>(FileInputStream.java:66)
	at 
sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:69)
	at 
sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:156)
	at java.net.URL.openStream(URL.java:913)
	at 
org.enhydra.apache.xerces.readers.DefaultReaderFactory.createReader(DefaultReaderFactory.java:149)
	at 
org.enhydra.apache.xerces.readers.DefaultEntityHandler.startReadingFromDocument(DefaultEntityHandler.java:493)
	at 
org.enhydra.apache.xerces.framework.XMLParser.parseSomeSetup(XMLParser.java:314)
	at org.enhydra.apache.xerces.framework.XMLParser.parse(XMLParser.java:1097)
	at org.enhydra.apache.xerces.readers.XCatalog$Parser.<init>(XCatalog.java:451)
	at org.enhydra.apache.xerces.readers.XCatalog.loadCatalog(XCatalog.java:223)
	at 
org.enhydra.xml.io.XMLEntityResolver.loadCatalog(XMLEntityResolver.java:130)
	at 
org.enhydra.xml.xmlc.parsers.xerces.XercesParser.parse(XercesParser.java:227)
	at org.enhydra.xml.xmlc.compiler.Parse.parse(Parse.java:232)
	at 
org.enhydra.xml.xmlc.deferredparsing.DocumentLoaderImpl.parseDocument(DocumentLoaderImpl.java:519)
	at 
org.enhydra.xml.xmlc.deferredparsing.DocumentLoaderImpl.getCacheEntry(DocumentLoaderImpl.java:169)
	at 
org.enhydra.xml.xmlc.deferredparsing.DocumentLoaderImpl.getDocument(DocumentLoaderImpl.java:223)
	at 
org.enhydra.barracuda.tutorials.xmlc.HelloWorld3XMLImpl.buildDocument(HelloWorld3XMLImpl.java:104)
	at 
org.enhydra.barracuda.tutorials.xmlc.HelloWorld3XMLImpl.<init>(HelloWorld3XMLImpl.java:84)
	at 
org.enhydra.barracuda.tutorials.xmlc.HelloWorld3XMLImpl.<init>(HelloWorld3XMLImpl.java:96)


If I use the XMLCStdFactory to load the class, everything works fine, but I 
think that is only because it doesn't have to re-check the document at 
runtime since it was processed at compile-time and doesn't get re-processed 
at runtime like it does with deferred parsing.

I even tried putting tutorials.xcat in the location under the 
Windows\System32 folder where it is looking for the file.  The 
tutorials.xcat file was found, but then it can't find the DTD....

org.enhydra.xml.xmlc.XMLCRuntimeException: Parse of 
"file:/D:/Java/Apache/Jakarta/tomcat-5.0.7/webapps/Barracuda/WEB-INF/classes/org/enhydra/barracuda/tutorials/xmlc/HelloWorld3.xml" 
failed: org.xml.sax.SAXException: Stopping after fatal error: File 
"file:/org/enhydra/barracuda/tutorials/xmlc/HelloWorld3.dtd" not found.

Can anyone think of a workaround for this?  Does it require a code 
modification XMLC XMLEntityResolver?  Is it even possible to make this work 
without breaking something else?

Crap, I thought we had everything figured out.  Hopefully we can come up 
with a quick fix for this, but it has to be ASAP.  We need to release XMLC 
by this weekend or at least by Monday.  The Enhydra team is expecting this 
and Barracuda to be released at that time so they can integrate the 
packages with their server.

Jake
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.