Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] XOMHandler with DocType.setInternalSubset() bug

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: Wolfgang Hoschek <whoschek AT lbl.gov>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] XOMHandler with DocType.setInternalSubset() bug
  • Date: Thu, 22 Sep 2005 14:21:07 -0400

Wolfgang Hoschek wrote:
It may have fixed some case, but unfortunately not mine.
The external entity used reads as follows

[hoschek /testsuite] cat copy/ent21.xml
<?xml version="1.0" encoding="UTF-8" ?>
<extEnt attr="x"><sub2>z</sub2></extEnt>


OK. I've looked at it more closely. I think what's happening is that your code depends on a bug that I've now fixed. For a while when reporting relative URLs found in external ENTITY declarations, some SAX parsers including Xerces simply passed them on as is. Others including Crimson absolutized them. That is a URL such as data.xml might or might not get changed to something like file:///Users/elharo/tests/data.xml. I was primarily using a parser that did not absolutize them, and I suspect you were using a parser that did.

Starting with SAX 2.0.2, the SAX spec made it clear that parsers were expected to fully absolutize all URLs. Xerces implemented this behavior around 2.7 or 2.7.1. However, Crimson always did this; and I suspect you were using Crimson.

However I don't want XOM to do that. I expect XOM to maintain the original internal DTD subset, relative URLs and all, to the maximum extent possible. When I noticed Xerces had changed its behavior I wrote a workaround for Xerces that restored the original relative URLs. The same code is what I think broke your tests with Crimson.

If you want BNUX to be a self-contained data format, then you really could avoid external entity declarations completely. There's not a lot of need to include them. If you do include them, then the data is really not self-contained. You might even want to get rid of the DOCTYPE. A document with a DOCTYPE and anything beyond the internal DTD subset is really not self-contained.

If anyone would like to make a case that XOM should absolutize relative URLs found in the internal DTD subset, go ahead. There are arguments on both sides of this. My gut is that absolutizing relative URLs on a round trip is wrong since it can point the declarations at a different host as the document is moved. However, there are reasons to absolutize them as well which is why SAX settled on this behavior as the default.

--
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