Posted to tcl by oldlaptop at Thu Mar 26 16:43:56 GMT 2026view raw

  1. % package require tdom
  2. 0.9.6
  3. % dom createDocument foo doc
  4. domDoc0x559b7fb284c0
  5. % [$doc documentElement] appendChild [$doc createElement bar child]
  6. domNode0x559b7fb28880
  7. % $doc asXML
  8. <foo>
  9. <bar/>
  10. </foo>
  11.  
  12. % $child setAttributeNS urn:spam s:like no
  13. domNode0x559b7fb28880
  14. % $doc asXML
  15. <foo>
  16. <bar s:like="no"/>
  17. </foo>
  18.  
  19. % $doc createElement baz child2
  20. domNode0x559b7fb289a0
  21. % $child2 setAttributeNS urn:spam s:like yes
  22. domNode0x559b7fb289a0
  23. % $child2 asXML
  24. <baz s:like="yes"/>
  25.  
  26. % [$doc documentElement] appendChild $child2
  27. domNode0x559b7fb289a0
  28. % $doc asXML
  29. <foo>
  30. <bar s:like="no"/>
  31. <baz xmlns:s="urn:spam" s:like="yes"/>
  32. </foo>
  33.  
  34. % # 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.)
  35.  

Add a comment

Please note that this site uses the meta tags nofollow,noindex for all pages that contain comments.
Items are closed for new comments after 1 week