[jdom-interest] no parser on classpath but things work... I can't explain this... canyou?
Martin Bravenboer
martin at pandoramix.org
Sat Jul 28 03:18:06 PDT 2001
Hey,
> I'm writing this at an airport, so I can't check the docs, but I suspect
> search-path would only have an effect when you do "jdom -jar jdom.jar"
> but not when jdom.jar is just in the classpath. It doesn't seem "right"
> that including various JARs would implicit include their search-path
> entries.
Stupid me :-) I think this is true. I've checked the jar specs:
"Class-Path : The value of this attribute specifies the relative URLs of the
extensions or libraries that this application or extension needs. URLs are
separated by one or more spaces. The application or extension class loader
uses the value of this attribute to construct its internal search path. "
It's not very clear, but indeed Xerces didn't work in a small test when I
removed it from my classpath.
This still leaves the original question open:
> what I can't figure out is why does this work when jdom.jar is the only
> jar on the classpath? I'm certain that I'm not picking up any other
> parser 'cause when I take jdom off things fail. I checked the jdom.jar
> and can't see any parser packages in there... so what magic is JDOM
> doing to make this work?
If you output the classname of the parser that is used, you can figure out
what is going on:
XMLReader reader =
SAXParserFactory.newInstance().newSAXParser().getXMLReader();
System.out.println("XMLReader: " + reader.getClass().getName());
Greetz,
Martin
More information about the jdom-interest
mailing list