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: Grant Wood <grant AT nanode.org>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] Preserving base URIs on detachment
  • Date: Fri, 26 Mar 2004 13:44:38 -0600


On Mar 25, 2004, at 10:47 PM, Elliotte Rusty Harold wrote:

Document doc = builder.build("http://www.example.com/";);
Element child = new Element("child");
// child.getBaseURI() returns null
doc.getRootElement().appendChild(child);
// child.getBaseURI() returns http://www.example.com
child.detach()

What should child.getBaseURI() return now? null or http://www.example.com?
--


In the case where (continuing from your example):
Document newdoc = new Document(child);

Shouldn't:
newdoc.getBaseURI().equals( newdoc.getRootElement().getBaseURI() );
be true?

If it is true, then either:

a) The Document(Element root) constructor inherits BaseURI from root
-or-
b) The Document(Element root) constructor resets root's BaseURI to some default

What is the current behavior for this constructor with regards to BaseURIs? a) seems wrong to me, but since I can think of no other reasons for preserving the BaseURI of a detached element, I think null is the appropriate value to return.

Am I missing something? Is there a specific use case you're thinking of where preserving the BaseURI makes sense?


Grant Wood
Nanode LLC
grant at nanode.org
www.nanode.org





Archive powered by MHonArc 2.6.24.

Top of Page