Default attributes

Hi all,

DOM Level 1 was designed to work with XML 1.0 only. XML Namespaces
didn't exist, and DTDs were the only type of grammar that was used with
XML. Because DTDs provide a simple and straightforward way of
associating default attributes with elements, the DOM Level 1 was made
so that default attributes were handled automagically by the
implementation. This included adding them on element creation as well as
adding them back on removal of specified attributes for which a default
value exists.

DOM Level 2 came out with additional support to cope with XML
Namespaces. However, because DTDs are not "namespace aware", several
issues were later found with the way namespaces interact with DTD
information in general, and default attributes in particular. Namely,
because the DOM doesn't perform any namespace binding it is unclear how
default attributes should be updated in cases where the qualified name
of an element or an attribute is changed, through the change of its
prefix.

Now, with the introduction of XML Schemas, the task has become even more
challenging. One might like the DOM implementation to have a similar
behavior with regard to default attributes, but with XML Schemas the
name and namespace URI of an element are not even enough to specify its
type. The type of an element may vary according to its position in the
tree!

The three put together creates a level of complexity that makes it
basically impossible to define something that would be understandable by
both users and implementors, and it is believed that it will in any case
be error prone, both at the level of the spec and the implementations. 

As an alternative, the Working Group is considering backing off from the
currently defined behavior and specify in DOM Level 3 that attributes
are not updated dynamically as the tree is being mutated but instead are
only updated according to the governing grammar at specific times.
Specifically at the time the normalizeDocument() method is called.

We do realize, however, that this change would introduce some backward
incompatibility with the previous versions of the DOM. We would
therefore appreciate feedback from others on whether this is seen as too
disruptive or whether the gain in simplicity and better interoperability
is worth this breakage.

Thanks in advance for your input.
-- 
Arnaud  Le Hors - IBM, XML Standards Strategy Group / W3C AC Rep.

Received on Wednesday, 19 December 2001 18:16:42 UTC