Hi Scott,
At 03:25 AM 3/3/2006 -0500, Scott Cantor wrote:
I don't think is a bug, but it's decidedly odd behavior, in my opinion, at
least based on a lot of obvious uses for the method. I'm sure it's not a bug
in fact, because the code is directly from the DOM3 spec, which says to
implement lookupNamespaceURI such that no namespace declaration has to be
present in the DOM in order for the function to return a result for a given
prefix. Namely if some element at or above the node is assigned a prefix and
a namespace, it will match it and return that namespace.
So I have a non-wellformed document, but the lookup function is telling me
that the prefix is "bound" to that namespace. This seems off to me.
Example:
DOMElement e: <ns:foo> where the NamespaceURI is http://foo.com
e->lookupNamespaceURI("ns") returns "http://foo.com"
I would have intuitively expected the element to have to look like:
<ns:foo xmlns:ns="http://foo.com">
So, what am I missing? What good is the method if by XML processing rules
the prefix isn't actually going to be valid when I serialize the document?
The DOM is allowed to be in a state where there is no xmlns:ns=""
namespace declaration and "ns" is used as the prefix of an element or
attribute; the serialization code will handle this case by adding the
declaration on the fly (and renaming conflicting prefixes if bound to
different URIs in the same scope).
Hope this helps,
Alberto
-- Scott
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]