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: Adam Constabaris <adamc AT unc.edu>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] XOM 1.1 proposal: xml:id
  • Date: Thu, 20 Jan 2005 12:11:12 -0500

Dirk Bergstrom wrote:
John Cowan was heard to exclaim, On 01/20/05 05:18:

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;


I've looked over the W3C recommendation, and a couple other pages I found on
google, but I still don't understand the *purpose* of xml:id. All I can find
is discussion about implementation details. Can someone provide a quick
explanation of why I might want to use xml:id, perhaps with a semi-real-world
example?


xml:id is designed to give you the benefits of having ID attributes in your documents without specifically referring to a DTD or XML Schema that identifies a particular attribute as being of type ID (which is the only way to do it now). An ID attribute's value must be unique within a document; XPath, e.g. provides the id() function to allow fetching a node with a specific ID. An ID attribute is thus kind of like a database primary key.

A semi-real world example is on the working draft of the spec at

http://www.w3.org/TR/xml-id/

=====================================
However, some specifications, notably [SOAP], forbid an internal subset, and processing the external subset is optional for conformant XML processors, leaving no guarantee that all consumers of the XML document will be able to successfully recognize the identifiers.

IOW, you can't guarantee that any DTD you supply in a SOAP message will be honoured, but you might nevertheless want to use ID-type attributes in such a message.

AC




Archive powered by MHonArc 2.6.24.

Top of Page