[jdom-interest] org.jdom.JDOMException: Error on line 548 of document file://d/XMLTest/xml/drawing.mod: Reference to undefined parameter entity "%{0};".

Hemanth Raju hemanth.raju at net-linx.com.my
Mon Dec 2 02:55:08 PST 2002


Hi Norrman,

	Yes, both office.dtd and content.xml files are in the same directory and I
changed my code .

	I changed my code as below, but If I am using a SAXBuilder its giving me
the following Error:

My code:

public class ParseXML
{
	public static void main(String[] args) throws JDOMException,
MalformedURLException
	{
        	ParseXML parseXML1 = new ParseXML();
		SAXBuilder saxBuilder = new SAXBuilder(true);
		Document doc = null;
		try
		{
		    doc = saxBuilder.build(new File("D:\\XMLTest\\xml\\content.xml"));
		}
		catch(JDOMException jdome)
		{
			System.out.println("JDOM Exception while building Document Object : " +
jdome.getMessage() + "\n");
			System.out.println(jdome.getStackTrace());
		}
		System.out.println("Root Element = " + doc.getRootElement().getName());
	}
}

-----------------------------
The Error:

org.jdom.JDOMException: Error on line 548 of document
file://d/XMLTest/xml/drawing.mod: Reference to undefined parameter entity
"%{0};".
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:296)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:617)
at xmlparsingusingjdom.ParseXML.main(ParseXML.java:53)
Root cause: org.xml.sax.SAXParseException: Reference to undefined parameter
entity "%{0};".
at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3182)
at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3170)
at org.apache.crimson.parser.Parser2.getc(Parser2.java:3061)
at org.apache.crimson.parser.Parser2.maybeWhitespace(Parser2.java:603)
at org.apache.crimson.parser.Parser2.getcps(Parser2.java:1980)
at org.apache.crimson.parser.Parser2.getMixedOrChildren(Parser2.java:1919)
at org.apache.crimson.parser.Parser2.maybeElementDecl(Parser2.java:1881)
at org.apache.crimson.parser.Parser2.maybeMarkupDecl(Parser2.java:1210)
at
org.apache.crimson.parser.Parser2.externalParameterEntity(Parser2.java:2898)
at org.apache.crimson.parser.Parser2.maybePEReference(Parser2.java:2574)
at
org.apache.crimson.parser.Parser2.externalParameterEntity(Parser2.java:2895)
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:287)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:617)
at xmlparsingusingjdom.ParseXML.main(ParseXML.java:53)
Exception in thread "main"

There are a bunch of .mod files which are required by "office.dtd" file and
"drawing.mod is one of them. Attached are both content.xml, office.dtd and
drawing.mod files.

What am I missing? Will be looking forward. Thanks a million in advance.

Regards,
Raj



-----Original Message-----
From: Norrman Per [mailto:per.norrman at canovia.se]
Sent: Friday, November 29, 2002 8: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/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: content.xml
Type: text/xml
Size: 5026 bytes
Desc: not available
Url : http://jdom.org/pipermail/jdom-interest/attachments/20021202/5fc94be3/content.xml
-------------- next part --------------
A non-text attachment was scrubbed...
Name: drawing.mod
Type: application/octet-stream
Size: 46370 bytes
Desc: not available
Url : http://jdom.org/pipermail/jdom-interest/attachments/20021202/5fc94be3/drawing.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: office.dtd
Type: text/xml
Size: 2936 bytes
Desc: not available
Url : http://jdom.org/pipermail/jdom-interest/attachments/20021202/5fc94be3/office.xml


More information about the jdom-interest mailing list