Thomas DeWeese wrote: >> It seems to me that namespace prefix tags are mere artifacts of the >> way XML documents are encoded as flat files, and are not actually >> part of the DOM. > > Well the DOM is perfectly aware of the prefixes. In fact > the DOM clearly states that setAttributeNS takes a qname, which > is the name of the attribute with it's prefix.
Oops, you are exactly right.. I didn't realize setAttributeNS() required a qualified tag name. That seems weird to me, but whatever. With that change, it seems to do the right thing, even if you try to "reuse" a namespace prefix that's already defined in a containing tag for a different namespace. However, this won't work: setAttributeNS(FOO_NS, "blah:attr1", "hello1"); setAttributeNS(BAR_NS, "blah:attr2", "hello2"); It exports both attributes under "FOO_NS" (using the "blah" prefix). It's not clear what the right behavior is in that case. So this API is badly designed IMHO. E.g., two unrelated pieces of code might want to both add attributes to the same node, using different namespaces, yet they would not know how to choose unique prefixes for those namespaces. -Archie __________________________________________________________________________ Archie Cobbs * CTO, Awarix * http://www.awarix.com * Confidentiality Notice: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. * --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]