From: Steve B. <Ste...@zv...> - 2001-05-09 05:22:59
|
Joe English wrote: > > > > You need to create a root element node before serializing the > > > document; things should work properly then. > > > > So how do I create a "root element"? > > Ah, now I see the problem: one of the main differences between > dom::tcl and dom::c is that, in dom::tcl, > > dom::document createXXX $parent ... > > adds the new node as a child of $parent, whereas > dom::c creates it as an unattached, parentless node. > You have to add the new node "by hand", e.g.,: > > dom::node appendChild $parent [dom::document createXXX $parent ...] > > The dom::tcl behaviour is more intuitive and useful, > but the dom::c behaviour matches the W3C DOM specification > more closely. When I last asked Steve about this he > indicated that it would be best to follow the W3C spec. > > Steve - is this still your take on things, or would > it be better to change dom::c to match the documentation > and dom::tcl? After some time for reflection, I think we'll stick with the non-standard feature. If users want to, they can use TclDOM in such a manner that it is standard (ie. create node using factory method, then insert). My plan for TclDOM is to make a 'theta' release like I did for TclXML. That work will involve bringing the C and Tcl implementations into sync, as well as perhaps adding support for tDOM-style features, like more OO style node commands. Of course, we'll throw in DOM Level 2 and 3 support for good measure ;-) Now I just have to find the time... Cheers, Steve Ball -- Steve Ball | waX Me Lyrical XML Editor | Training & Seminars Zveno Pty Ltd | Web Tcl Complete | XML XSL http://www.zveno.com/ | TclXML TclDOM | Tcl, Web Development Ste...@zv... +---------------------------+--------------------- Ph. +61 2 6242 4099 | Mobile (0413) 594 462 | Fax +61 2 6242 4099 |