Skip to Content.
Sympa Menu

xom-interest - Re: [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: Elliotte Harold <elharo AT metalab.unc.edu>
  • To: John Cowan <jcowan AT reutershealth.com>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] XOM 1.1 proposal: xml:id
  • Date: Thu, 20 Jan 2005 09:02:16 -0500

John Cowan asked me to look at implementing xml:id in XOM. herewith are some initial thoughts.

IDness intersects XOM in three places:

1. Shorthand XPointers used in XInclude
2. The XPath id() function
3. The type of the xml:id attribute returned by getType()

1 is straightforward to implement. 2 is not hard, though it's arguably incorrect with respect to the XPath spec.

3 is where matters get tricky. To really implement xml:id in this context some behavioral changes need to be made:

1. xml:id attribute values must be normalized by XOMHandler, even if the parser doesn't do it.

2. Should we also autonormalize when the attribute value is set?

3. Should the type be reported as ID even if the schema declares a different type such as CDATA or NMTOKEN?

4. Error handling. The spec states,

An xml:id processor must assure that the following constraints hold for all xml:id attributes:

* The normalized value of the attribute is a valid NCName.
* The declared type of the attribute, if it has one, is “ID”. All declarations for xml:id attributes must specify “ID” as the type of the attribute.

An xml:id processor should assure that the following constraints hold:

* The values of all xml:id attributes and all attributes of type “ID” within a document are unique.

An xml:id error occurs for any xml:id attribute that does not satisfy the constraints.

An xml:id error is a non-fatal error, but that conflicts with the *must* requirements.

Do we really want to reject documents on parse that do not satisfy the first two constraints? Maybe. There's not a lot of legacy here to worry about, and it's in keeping with XOM's authoritarian bent. If so, XOM should also reject setting the xml:id value or type to an illegal value. If we do this, it answers question 3 as well.




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