Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] mysterious error when parsing OpenOffice document

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Brian Slesinsky <brian AT slesinsky.org>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: [XOM-interest] mysterious error when parsing OpenOffice document
  • Date: Mon, 6 Dec 2004 20:00:42 -0800

Hi, has anyone had any success parsing OpenOffice documents with XOM? I get a mysterious error:

nu.xom.ParsingException: Reference to undefined parameter entry "%{0};". at line 548, column -1.

The thing is, I can't find the line that has the error. It think it must be one of the files included by office.dtd, but which one? A grep doesn't any such parameter entry. It sure would be nice if XOM reported both file and line number for errors in included files.

Here's the relevant code. (I set the baseURL to the directory containing the OpenOffice dtd because the systemID for an OpenOffice document is just "office.dtd", without any path.)

private Document readOfficeDocument(File file)
throws IOException, ParsingException {

ZipFile zip = new ZipFile(file);
InputStream in = zip.getInputStream(zip.getEntry("content.xml"));
Builder builder = new Builder();
URL dtdDir = new File("/usr/lib/openoffice/share/dtd/officedocument/1_0").toURL();
return builder.build(in, dtdDir.toExternalForm());
}

Thanks,
Brian





Archive powered by MHonArc 2.6.24.

Top of Page