Re: setting Node.prefix

"Fred L. Drake, Jr." wrote:
> 
> Garret Wilson writes:
>  > Right; I'm assuming (although I didn't state it) that one sets the namespace
>  > URI first.
> 
>   The namespaceURI attribute is read-only in DOM Level 2.
> 
>  > such an element. It does say that, "For nodes of any type other than
>  > ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method,
>  > such as createElement from the Document interface, this is always null." But
>  > if this implies that the prefix cannot be set, is there an exception thrown,
>  > or is the new prefix simply ignored?
> 
>   I would expect to get either and NAMESPACE_ERR or a
> NO_MODIFICATION_ALLOWED_ERR here.

As I said, you'll get a NAMESPACE_ERR DOMException if you try to set the prefix
with
a null namespaceURI. The recommendation is clear on that point. prefix will
always
be null for a DOM Level 1 node and there is no way to change that.
And Fred is right, there is no way to change the namespaceURI of a Node after
his creation: the Node.namespaceURI attribute is read-only.

Philippe

Received on Friday, 22 December 2000 11:14:11 UTC