[jdom-interest] jdom and jdk1.4: EntityResolver no longer called

soeren.arleth SOEREN.ARLETH at oracle.com
Tue Feb 19 12:06:29 PST 2002


Hi,
just to add some information... Crimson it is.
Recently I installed 1.4.0 in which I have found the the following code. This shows for a fact what Jason suspected:
public static SAXParserFactory newInstance()
throws FactoryConfigurationError
{
try {
return (SAXParserFactory) FactoryFinder.find(
/* The default property name according to the JAXP spec */
"javax.xml.parsers.SAXParserFactory",
/* The fallback implementation class name */
"org.apache.crimson.jaxp.SAXParserFactoryImpl");
} catch (FactoryFinder.ConfigurationError e) {
throw new FactoryConfigurationError(e.getException(),
e.getMessage());
}
}
cheers
Søren
___________________________________

Soeren Arleth - Oracle Denmark
SME Java Development
EMEA Java/XML Professional Community





I was hoping someone else with more information might write to help
you. But since they haven't, I'll say what I can.

I would look into what parser JDK 1.4 is using. I suspect it's some
version of Crimson as selected by JAXP since JAXP is now in the JDK. 
Write the list when you find out since it'll be good for us to know.

Then I'd look into if that Crimson version has any known problems like
this, and I'd file a bug if they don't already know. We can help you
with that.

Finally, if it is a parser bug as I suspect, then I'd change parsers to
Xerces either by using the JAXP API to select Xerces, or you can use
SAXBuilder itself to select Xerces. SAXBuilder by default uses JAXP to
select a parser, but you can choose explicitly.

I suggest you investigate JDK 1.4 because this will hit other people, so
hopefully we can understand the issue and not just go straight to
avoidance.

-jh-

abrighto at netscape.net wrote:
> 
> Hi all,
> 
> The new jdk1.4 runtime library now contains the org.xml packages,
> which kind of forces you to use them, it seems (I was previously
> using xerces.jar).
> 
> Since upgrading to jdk1.4, I am having problems with DTDs not being
> resolved. The problem is that the EntityResolver is not being called.
> The error message is then:
> 
> "Relative URI "UIInfo.dtd"; can not be resolved without a base URI"
> 
> Here is the related code. Any ideas on how to make this work with jdk1.4?
> 
> /** Parse the XML document */
> private static void _parseDocument(BufferedReader in) {
> SAXBuilder builder = new SAXBuilder(true);
> builder.setEntityResolver(new EntityResolver() {
> public InputSource resolveEntity (String publicId, String systemId) {
> URL url = Resources.getResource("UIInfo.dtd");
> try {
> return new InputSource(url.openStream());
> }
> catch(Exception e) {
> throw new RuntimeException("Error resolving entity: " +
> publicId + ": " + e.toString());
> }
> }
> });
> 
> try {
> Document doc = builder.build(in);
> Element rootElement = doc.getRootElement();
> Iterator it = rootElement.getChildren().listIterator();
> while(it.hasNext()) {
> Element e = (Element)it.next();
> _parseElement(e);
> }
> }
> catch (JDOMException ex) {
> ex.printStackTrace();
> throw new RuntimeException("Error reading " + XML_FILE + ": " + ex.getMessage());
> }
> }
> 
> Thanks,
> Allan Brighton
> 
> --
> 
> __________________________________________________________________
> Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop at Netscape! http://shopnow.netscape.com/
> 
> Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20020219/e5278bfb/attachment.htm


More information about the jdom-interest mailing list