Posted to tcl by oldlaptop at Thu Mar 26 16:43:56 GMT 2026view raw
- % package require tdom
- 0.9.6
- % dom createDocument foo doc
- domDoc0x559b7fb284c0
- % [$doc documentElement] appendChild [$doc createElement bar child]
- domNode0x559b7fb28880
- % $doc asXML
- <foo>
- <bar/>
- </foo>
-
- % $child setAttributeNS urn:spam s:like no
- domNode0x559b7fb28880
- % $doc asXML
- <foo>
- <bar s:like="no"/>
- </foo>
-
- % $doc createElement baz child2
- domNode0x559b7fb289a0
- % $child2 setAttributeNS urn:spam s:like yes
- domNode0x559b7fb289a0
- % $child2 asXML
- <baz s:like="yes"/>
-
- % [$doc documentElement] appendChild $child2
- domNode0x559b7fb289a0
- % $doc asXML
- <foo>
- <bar s:like="no"/>
- <baz xmlns:s="urn:spam" s:like="yes"/>
- </foo>
-
- % # Why does $child not get its namespace binding for s:? And why does $child2 only get it once it's been appended to something? (An identity XSL transformation also magically causes the namespace bindings to appear.)
-
Add a comment