- From: Bjoern Hoehrmann <derhoermi@gmx.net>
- Date: Mon, 06 Aug 2007 16:12:23 +0200
- To: "Joćo Eiras" <joao.eiras@gmail.com>
- Cc: www-dom@w3.org
* Joćo Eiras wrote: >node.setAttribute('xmlns','http://example.com/'); >I see only two possible outcomes: either an exception is throw or the >DOM tree has to be rebuilt at runs time. I am not sure why either would happen. The DOM Core Recommendation quite clearly says you should not mix namespaces and namespace-unaware methods and setAttribute is namespace-unaware. What happens should be clear, the same thing as would happen if you'd used 'foo' instead of 'xmlns'. There does not need to be an exception, nor would have this any effect on the namespaces in the document. Note that especially the latter is also the case if you do e.g. node.setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:x', '...') which is quite legal and would not affect the namespaces of <x:x/> ele- ments, or <y x:x=''/> attributes. The only way to rename elements and attributes is through the renameNode method. Due to this, it is possible to create documents that are incorrect with respect to namespaces; there are fixup algorithms in the specification to correct such errors e.g. during serialization of the document. This should all be explained in e.g. section 1.3.3 XML Namespaces of the Recommendation. -- Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de 68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
Received on Monday, 6 August 2007 14:12:29 UTC