Re: DOM 3 Core namespace normalisation and Level 1 nodes

On Thu, 2004-02-19 at 07:31, Andrew Clover wrote:
> There's an issue with namespace normalisation in the reference algo
> (B.1) in PR which I hadn't noticed until DOM-TS started testing for
> it:
> 
>     if ( Element's localName is null )
>     {
>        // DOM Level 1 node
>        [...]
>        Otherwise, report an error
> 
> I believe this behaviour to be undesirable. It would mean you'd be
> unable to serialise any document containing Level 1 Elements
> (or Attrs) without deliberately setting the DOMConfiguration
> parameter 'namespaces' to false.

This is correct. DOM Level 1 applications need to be careful about this
before invoking a load, parse, or normalizeDocument methods.

> Previously Core has only warned that "mixing both sets of methods
> can lead to unpredictable results"; this is the first time it has
> been made an actual error. Though there are indeed cases where
> mixing levels causes problems, there are also common trivial cases
> which are unambiguous.

We still believe that it is dangerous to mix non-namespaces and
namespaces aware nodes in the same tree. This reflects a design problem
in the DOM application.

> In my opinion, raising a warning may be appropriate, but making it
> an error (so that by default processing stops altogether) seems
> excessively harsh and likely to bite application authors a lot.

The default processing may not cause the processing to stop if the error
can be recovered (cf [1]). Continuing the processing if the mistake
cannot be recovered would be harmful if the document is being serialized
for example.

> There are still times where it is useful for a function to, for
> example, add an unprefixed attribute to an element without caring
> whether the element is a Level 1 or 2 node.

As mentioned in the section regarding XML Namespaces (1.3.3), this
behavior should be avoided. 

> I'm not sure namespace normalisation should be touching Level 1
> nodes at all; perhaps it would make sense to raise an error only
> for clearly namespace-ill-formed names (eg. 'blob::'). Don't know
> if such a change is even possible at this late stage, but I thought
> I should bring it up.

If the processor believes that the error can be recovered, it is free to
continue the processing.

Regards,

Philippe

[1]
http://www.w3.org/TR/2004/PR-DOM-Level-3-Core-20040205/core.html#ERROR-DOMError-severity-error

Received on Thursday, 26 February 2004 17:33:13 UTC