logo       

Re: XMLCDeferredParsingFactory and classpaths: msg#00015

java.enhydra.xmlc

Subject: Re: XMLCDeferredParsingFactory and classpaths

Hi James,

See comments below...

At 10:18 AM 12/16/2003 +0000, you wrote:
Hi All,

I have just started looking at using XMLCs deferred parsing capabilities with Barracuda (very cool, thanks guys), but I'm experiencing a couple of difficulties with resource paths and classloading.

At <http://xmlc.enhydra.org/project/aboutProject/xmlc22release.html>http://xmlc.enhydra.org/project/aboutProject/xmlc22release.html it says that when using the XMLCDeferredParsingFactory, first the resource path is searched, then the classpath. If the resource is only found on the classpath, dynamic reloading will not work.

When I place my resources outside of the classpath, dynamic reloading works great:

xmlcDeferredParsingFactory.addResourceDir("/home/kipz/dev/someproject/resources_outside_classpath/");
xmlcDeferredParsingFactory.setDefaultMetaDataPath("options.xmlc");
Document page = xmlcDeferredParsingFactor.createFromFile("MyML.html");

But when I put them in a directory in the classpath:

xmlcDeferredParsingFactory.addResourceDir("/home/kipz/dev/someproject/com/mycompany/xmlc_on_classpath/");
xmlcDeferredParsingFactory.setDefaultMetaDataPath("options.xmlc");
Document page = xmlcDeferredParsingFactor.createFromFile("MyML.html");

Is "myML.html" actually in that "xmlc_on_classpath" directory or in some deeper directory path within that? Also, you probably shouldn't append the "/". Let's say you provide the resource path "/home/kipz/dev/someproject" and "myML.html is in the "com/mycompany" package. You would load it like this....
xmlcDeferredParsingFactor.createFromFile("com/mycompany/MyML.html");

Note that if your "myML.html" file wasn't found, it would then default to loading it from the classpath. This might be what you are experiencing. The path you are providing might simply be wrong, but XMLC still finds the file on the classpath so it loads it instead of the one it couldn't find on the resource path.


The resource is loaded correctly, but dynamic reloading no longer works, I suspect because they are being loaded from the classpath by a classloader.

Yep, but probably because you provided the wrong path to it within the resource path as stated above.

Any help/suggestions would be much appreciated.

James.

Hopefully that helps. Let me know if you are still having problems.

Jake


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise