Michael,
Thanks for the help. It actually turned out to be as simple as having the wrong jar in the classpath - setting the property below exposed this. I had xmlParserAPIs.jar instead of xercesImpl.jar in the classpath.
Once I put this in, the xerces 2 parser is being used properly, and I can now use the external entity references the way I wanted to originally. I don't need to set the property now either as JDOM is finding the xerces parser on its own.
Thanks
Chris
Michael Rafael Glavassevich wrote:
Oops,
that should have been org.apache.xerces.jaxp.SAXParserFactoryImpl. Try setting the javax.xml.parsers.SAXParserFactory to that value.
----------------------------- Michael Glavassevich [EMAIL PROTECTED] 4B Computer Engineering University of Waterloo
On Wed, 21 May 2003, Michael Rafael Glavassevich wrote:
Hi Chris,
JDK 1.4 ships with an XML parser. The one you have seems to have Crimson. Others may have versions of Xerces (which is an other issue if you want to override the version which comes with the JDK, in which case look at http://xml.apache.org/xalan-j/faq.html#faq-N100CB. It's an FAQ for Xalan, but applies for Xerces as well).
I've never used JDOM so I don't know how it's attempting to instantiate the XMLReader, though maybe it's using JAXP. Try setting javax.xml.parsers.SAXParserFactory (system property) on the command line to org.apache.xerces.parsers.SAXParser, and see what happens.
----------------------------- Michael Glavassevich [EMAIL PROTECTED] 4B Computer Engineering University of Waterloo
On Wed, 21 May 2003, Chris Cheshire wrote:
Michael,
Yes I am using sun's jdk
java version "1.4.1" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21) Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)
(on solaris 2.8 (intel) but that shouldn't make much difference)
I thought the jdk just had the interface definitions, not anything implemented? If not, how do I override that and force it to use the xerces2 classes?
Thanks
Chris
Michael Rafael Glavassevich wrote:
Hi Chris,
It looks like you have a classpath problem, or some piece of code has set
the org.xml.sax.driver property to
org.apache.crimson.parser.XMLReaderImpl, because all I see are classes
from the Crimson XML parser in your stack trace. You don't happen to be
using Sun's JDK 1.4?
----------------------------- Michael Glavassevich [EMAIL PROTECTED] 4B Computer Engineering University of Waterloo
On Wed, 21 May 2003, Chris Cheshire wrote:
Hi,
Sorry if this is in the archives, but I they aren't available at the moment.
I am using xml files for my configuration files for an application and I do not want to have to set up a webserver to make the DTDs available, but I can't get the doctype reference to work properly. The dtd cannot reference an absolute path - it must reference the current directory. I am using JDOM (beta 8) and the xerces2.4.0 parser
In my XML files I have tried <!DOCTYPE config SYSTEM "something.dtd"> and got: Caused by: org.xml.sax.SAXParseException: Relative URI "reportgenerator.dtd"; can not be resolved without a base URI. at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3182) at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3176) at org.apache.crimson.parser.Parser2.resolveURI(Parser2.java:2758) at org.apache.crimson.parser.Parser2.maybeExternalID(Parser2.java:2730) at org.apache.crimson.parser.Parser2.maybeDoctypeDecl(Parser2.java:1129) at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:489) at org.apache.crimson.parser.Parser2.parse(Parser2.java:305) at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:442) at org.jdom.input.SAXBuilder.build(SAXBuilder.java:354) ... 5 more
I have tried <!DOCTYPE config SYSTEM "file://some.dtd"> and got: Caused by: org.jdom.JDOMException: Error on line 3: External entity not found: "file://reportgenerator.dtd ".: reportgenerator.dtd at org.jdom.input.SAXBuilder.build(SAXBuilder.java:367) at org.jdom.input.SAXBuilder.build(SAXBuilder.java:673) at com.bigredwire.reportgenerator.ReportGeneratorXMLConfig.parseConfiguration(ReportGeneratorXMLCo nfig.java:193) ... 3 more Caused by: java.net.UnknownHostException: reportgenerator.dtd at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3182) at org.apache.crimson.parser.Parser2.externalParameterEntity(Parser2.java:2870) at org.apache.crimson.parser.Parser2.maybeDoctypeDecl(Parser2.java:1167) at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:489) at org.apache.crimson.parser.Parser2.parse(Parser2.java:305) at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:442) at org.jdom.input.SAXBuilder.build(SAXBuilder.java:354) ... 5 more
The only wayI can get the dtd to be found is by <!DOCTYPE config SYSTEM "file:///absolute/path/to/some.dtd">
I do not want to use this as it requires changing each dtd as it creates a reliance on a set directory structure, which I do not want.
How do I set the doctype to reference a DTD in the same directory as the xml file without giving an absolute pathname?
Thanks
Chris
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
