Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] XOM - CatalogResolver - XInclude - namespaces

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Harold <elharo AT metalab.unc.edu>
  • To: Luke Weese <lweese AT gmail.com>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] XOM - CatalogResolver - XInclude - namespaces
  • Date: Fri, 13 May 2005 15:54:52 -0400

Luke Weese wrote:

I have put together a help system based on Docbook XML, with a couple
of nasty requirements that are causing me trouble. These are XML
catalogs and XInclude support. I have had this working with libxml's
xmllint utility, but the need has arisen for a Java-based replacement.
XOM seems to be the only java API that supports XInclude with the
XPointer attribute, but alas, catalogs are not supported. I have
searched the list and found some instructions on using Apache's (Norm
Walsh's) ResolvingXMLReader to plug in catalog support, but I am
getting errors I do not understand.

Catalog support is on the TODO list, but probably not for 1.1. See http://www-128.ibm.com/developerworks/xml/library/x-mxd3.html

First, I'll explain my need for catalog support and how it relates to
XInclude. This is a sample line from an XML document:

<xi:include xmlns:xi="http://www.w3.org/2001/XInclude";
href="file:///fw/generic/genericText.xml"
xpointer="genericText_editKeyField" >

As you can see, the "href" attribute is not a valid url. With xmllint,
I used an XML catalog to rewrite the URI to a local file, like this:


What's wrong with it? It looks syntactically correct to me. Does it just point to the wrong place?


// srcFile is the XML file
System.setProperty("xml.catalog.files",
"/home/pulse/core/help/catalog.xml");
XMLReader parser = new org.apache.xml.resolver.tools.ResolvingXMLReader();
nu.xom.Builder builder = new nu.xom.Builder(parser);
nu.xom.Document input = builder.build(srcFile.getAbsolutePath());

builder.build throws a ParserException with the following message:
-- nu.xom.ParsingException: Additional namespace
http://www.w3.org/2001/XInclude conflicts with existing namespace
binding. at line -1, column -1.


I don't know what's going on here either. It's possible ResolvingXMLReader is buggy and misreporting namespaces. It wouldn't be the first bug XOM uncovered in ResolvingXMLReader. It would help if there were a reasonably self-contained test case that could be debugged.

--
Elliotte Rusty Harold elharo AT metalab.unc.edu
XML in a Nutshell 3rd Edition Just Published!
http://www.cafeconleche.org/books/xian3/
http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim




Archive powered by MHonArc 2.6.24.

Top of Page