Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Preserving base URIs on detachment

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] Preserving base URIs on detachment
  • Date: Sat, 27 Mar 2004 00:31:08 -0500

I'm continuing to think about this. It occurs to me it might be helpful to consider the use cases. In particular, if someone does add a new element with no explicit base URI to a previously parsed document what are they likely to want?

This only really matters at all if that element somehow contains a relative URI, e.g. in an href attribute. Otherwise the question is moot.

If it does contain a relative URI, then I think they expect that URI to be resolved relative to something and the only plausible thing for it to be resolved relative to (assuming no explicit base URI has been set, in which case, again, the question is moot) is the base URI inherited from the parent element and its ancestors.

Therefore, it makes sense that when the element is detached it retains the base URI it would have had in the original document, even if it was created from memory.

On the other hand, if the element is then added to another document with a different base URI, and then a child with no base URI is added to the detached element, it may be a surprise that relative URIs in the child are resolved relative to the old document and not the new one. Damn. Thought I had the answer for a minute. Damn. This is a real 51-49 situation. I think the most common use case still says all nodes should retain their maximally absolutized, actual base URIs when detached. But it's hardly the only use case. I just wish I could find one really convincing argument that demonstrated clearly what the right answer was.
--

Elliotte Rusty Harold
elharo AT metalab.unc.edu
Effective XML (Addison-Wesley, 2003)
http://www.cafeconleche.org/books/effectivexml
http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/cafeaulaitA




Archive powered by MHonArc 2.6.24.

Top of Page