Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] XOM 1.1 proposal: xml:id

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: John Cowan <jcowan AT reutershealth.com>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: [XOM-interest] XOM 1.1 proposal: xml:id
  • Date: Thu, 20 Jan 2005 08:18:31 -0500

The new xml:id spec is just about to become a Candidate Recommendation
of the W3C. I am proposing that XOM 1.1 include support for it.
See http://www.w3.org/TR/xml-id for what is currently the Last Call WD
but will soon be the CR draft.

The idea of xml:id is that it is an attribute which is always of type
ID even in the absence of a DTD declaration. By using it, documents can
gain the advantages of IDs without having to carry the burden of a DTD;
this is especially important because XSLT can generate references to an
external DTD but cannot create an internal one.

It's an error to have an xml:id attribute declared other than as type ID.
(It's implicitly tolerated to have it declared of type CDATA, because
SAX doesn't report the difference between a CDATA declaration and no
declaration at all.) It's also an error for the value to be other
than an NCName, or for two xml:id attributes to have the same value.

In any case, though, every xml:id attribute gets leading and trailing
whitespace removed, internal whitespace collapsed to a single space,
and its type set to ID.

I proposed privately to ERH to add a mutator to Document that would fix
up the document. He replied (and encouraged me to post to this list):

> I would prefer it to be more subtle; i.e. not add any new
> methods but change the behavior of existing methods, including XPath and
> XInclude, to match this, so that it works automatically without
> requiring an extra method call or cluttering up the interface of
> Document.

I'm not clear why XPath and XInclude are specially relevant; I'd think
it was Attribute.setType and Attribute.setValue that need to change in
order to make this work automatically. The xml:id recommendation
does not require the uniqueness check (it's a SHOULD not a MUST),
so that check could be omitted in XOM or provided externally.

What do people think?

--
The experiences of the past show John Cowan
that there has always been a discrepancy jcowan AT reutershealth.com
between plans and performance. http://www.reutershealth.com
--Emperor Hirohito, August 1945 http://www.ccil.org/~cowan




Archive powered by MHonArc 2.6.24.

Top of Page