Re: DOM 3 LS DOMError unbound-namespace-in-entity

Andrew Clover wrote:
> DOMParser:
> 
> 
>>"unbound-namespace-in-entity" [warning]
>>Raised if the configuration parameter "entities" is set to true and
>>an unbound namespace prefix is encounterd in an entity declaration. 
> 
> 
> OK.

Turns out that that definition was wrong, the new definition (note the 
renaming too) is now:

[[
"unbound-prefix-in-entity" [warning]
     An implementation dependent warning that may be raised if
     the configuration parameter "namespaces" is set to true
     and an unbound namespace prefix is encountered in an
     entity declaration. Raising this warning is not enforced
     since some existing parsers may not recognize unbound
     namespace prefixes in an entity declaration.
]]

> 
> DOMSerializer:
> 
> 
>>"unbound-namespace-in-entity" [warning] 
>>Raised if the configuration parameter "entities" is set to true and
>>an unbound namespace prefix is encounterd in a referenced entity. 
> 
> 
> Does this mean...
> 
>  a. prefixes unbound in an entity declaration cause an error (as for
>     DOMParser), or
> 
>  b. prefixes unbound in an entity declaration cause an error only if they
>     are referenced somewhere in the document, or
> 
>  c. prefixes unbound in an entity reference cause an error?
> 
> IOW, if one were to parse -
> 
>   <!DOCTYPE x [
>     <!ENTITY e1 "<NS1:x/>">
>     <!ENTITY e2 "<NS2:x/>">
>     <!ENTITY e3 "<NS3:x/>">
>   ]>
>   <x xmlns:NS1="NS1">
>     &e1;
>     &e2;
>   </x>
> 
> and then re-serialise it, would one get 1, 2 or 3 unbound-namespace-in-entity
> warnings?
> 

The spec now defines this fatal error for DOMSerializer:

[[
  "unbound-prefix-in-entity-reference" [fatal]
     Raised if the configuration parameter "namespaces" is set to
     true and an entity containing unbound namespace prefixes is
     referenced in a location where there are no bindings for the
     namespace prefixes.
]]

IOW, you would get one fatal error for &e2; when serializing the above, 
but the above could never be parsed with "namespaces" set to true since 
parsing that would cause a fatal error (it's not namespace well-formed). 
So the above could only be achieved by adding &e2; to the DOM after 
parsing, and while parsing the above (w/o &e2;) you might get 3 
"unbound-prefix-in-entity" warnings, one for each entity, if your parser 
supports such a warning.

Thanks for noticing this, hopefully it's clear now, if not, let us know!

> PS. also, s/encounterd/encountered.
> 

Good catch. Fixed.

-- 
jst

Received on Wednesday, 10 September 2003 14:30:32 UTC