[jdom-interest] org.xml.sax.SAXParseException: Relative URI "office.dtd"; can not be resolved without a base URI.

Hemanth Raju hemanth.raju at net-linx.com.my
Fri Nov 29 02:38:19 PST 2002


Hi all,

	I am using the DOMBuilder to build a Document Object from an XML file which
is generated from OpenOffice ".sxw" file (content.xml). I has JBuilder6
running with both 1.3.1 and 1.4.0 JDK's.

	Whenever I am tring to build the Document Object from the XML file using
the DOMBuilder or SAXBuilder its throwing a SAXParseException.

My code is as follows:

	DOMBuilder domBuilder = new DOMBuilder();
	Document doc = domBuilder.build(new
URL("file:///d:/XMLTest/xml/content.xml"));
	System.out.println("Root Element = " + doc.getRootElement().getName());

and the exception is as follows:

Root cause: org.xml.sax.SAXParseException: Relative URI "office.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.apache.crimson.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:1
85) 	at
javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:86) 	at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
) 	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25) 	at
java.lang.reflect.Method.invoke(Method.java:324) 	at
org.jdom.adapters.JAXPDOMAdapter.getDocument(JAXPDOMAdapter.java:146) 	at
org.jdom.input.DOMBuilder.build(DOMBuilder.java:230) 	at
org.jdom.input.DOMBuilder.build(DOMBuilder.java:321) 	at
xmlparsingusingjdom.ParseXML.main(ParseXML.java:53) Exception in thread
"main"

I need to resolve this really fast. Anyhelp on this is very much
appreciated. Thanks in advance.

Will be looking forward.

Regards,
Raj




More information about the jdom-interest mailing list