[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:44:20 PST 2002


Hi again

My answer must've been confusing. The thing is that
DOMBuilder.build(File) and DOMBuilder.build(URL) both
creates InputStreams and calls DOMBuilder.build(InputStream).
This is why you get the exception.

If you would've used SAXBuilder, supplying a File, an URL or 
a String should all work OK.

Are you sure you tried SAXBuilder?

/pmn


-----Original Message-----
From: Norrman Per [mailto:per.norrman at canovia.se] 
Sent: Friday, November 29, 2002 1:11 PM
To: 'Hemanth Raju'; jdom-interest at jdom.org
Subject: RE: [jdom-interest] org.xml.sax.SAXParseException: Relative URI "
office.dtd"; can not be resolved without a base URI.


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/
_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com
###########################################

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