Posted to tcl by evilotto at Wed Jul 23 23:48:21 GMT 2014view raw

  1. package require tdom
  2.  
  3. set u urn:foo
  4. dom createDocumentNS $u Foo foo
  5. $foo createElementNS $u Bar bar
  6. $foo createElementNS $u Baz baz
  7. # swap the next 2 lines and the extra namespace declaration disappears
  8. $bar appendChild $baz
  9. [$foo documentElement] appendChild $bar
  10.  
  11. puts [$foo asXML -indent 4]
  12.