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]



Reply via email to