Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] A different question about xml:base

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: xom-interest <xom-interest AT lists.ibiblio.org>
  • Subject: [XOM-interest] A different question about xml:base
  • Date: Mon, 05 Apr 2004 21:13:03 -0400

A recent erratum to the XML Base spec states:

The base URI of an element bearing an |xml:base| attribute with a value that is not a valid URI reference is application dependent.

In this context, XOM is an application, and can do whatever it wants to in this case.
The question is what it should do. For example, consider this document:

<element xml:base="http://www.example.com/test/%GF.html"/>

What is the base URI of the element? Here are the possibilities I've thought of:

1. Return null (what XOM is doing now)
2. Return the value of the xml:base attribute untouched and unresolved.
3. Return the empty string

Any other ideas?

Related question:

Element root = new Element("root");
Document doc = new Document(root);

What should doc.getBaseURI() and root.getBaseURI() return? Currently null is being returned. However
according to RFC 2396:

A URI reference that does not contain a URI is a reference to the
current document. In other words, an empty URI reference within a
document is interpreted as a reference to the start of that document,
and a reference containing only a fragment identifier is a reference
to the identified fragment of that document.


Thus perhaps it makes sense here to return the empty string here instead of null? That would also avoid some possible unexpected NullPointerExceptions if a client forgot to do a null check.

--
Elliotte Rusty Harold




Archive powered by MHonArc 2.6.24.

Top of Page