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

Norrman Per per.norrman at canovia.se
Fri Nov 29 04:10:34 PST 2002


Hi,

1) Do not use DOMBuilder when building from a file or stream. It is
deprecated and b8.

2) Your XML file refers to DTD, and since you are supplying a stream, there
is no way for the parser to know where to find the DTD. You can a) build
directly from a java.io.File or b) create an org.xml.sax.InputSource on
the URL and build on that.

/pmn

-----Original Message-----
From: Hemanth Raju [mailto:hemanth.raju at net-linx.com.my] 
Sent: Friday, November 29, 2002 11:38 AM
To: jdom-interest at jdom.org
Subject: [jdom-interest] org.xml.sax.SAXParseException: Relative URI
"office.dtd"; can not be resolved without a base URI.


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());

###########################################

This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
For more information, connect to http://www.F-Secure.com/



More information about the jdom-interest mailing list