Version 18 of TclDOM

Updated 2003-02-24 11:39:38

TclDOM, maintained at http://sourceforge.net/projects/tclxml , is the DOM part of Zveno's TclXML project.

TclDOM has partial pure-Tcl-coded XPath support, as of September 2001.

An example application using TclDOM/libxml2 is tkxmllint, a GUI for xmllint. For Mac OS X or Windows at http://tclxml.sourceforge.net/tkxmllint.html

Version 2.5 of TclDOM adds a couple of new example scripts that may be useful:

    domtext: displays a DOM document in a Tk Text widget
    domtree: displays a DOM document's tree structure in a
        BWidget Tree widget.

Andreas Kupries provides a daily snapshot of the SourceForge CVS depot at http://www.purl.org/net/akupries/soft/cvs-snapshots/ .

AK: Note: There are more places to find Tcl binaries and sources than my site.

ActiveState Corporation's ActiveTcl also includes a TclDOM version.


Documentation appears (also?) at http://aspn.activestate.com/ASPN/Products/ActiveTcl/tcldom/index.html .


If you are trying to load TclDOM into a safe slave interpreter see the notes under TclXML. - PT


Steve Ball: "The only software in the TclXML stable that will validate a document is TclDOM+libxml2.". This package is also known as Tcldomxml. It wraps a TclDOM-API around GNOME's libxml [L1 ] and provides the basis for TclXSLT.


CThatcher: TclDOM seems to be missing a few important features - like the ability to parse new data into an arbitrary place in a DOM document. The only parse feature creates a new document each time and most of the ::node:: operations (like appendChild) simply complain that the node needs to be in the same document. If anyone knows a quick and easy way to do the above with TclDOM please let me know.

Steve Ball: DOM Level 3 introduces an "importNode" method that may solve this problem. Someone just has to implement it ;-)

TclDOM (pure Tcl) parsing simply invokes the TclXML parser and sets callbacks to manage creation and insertion of nodes. It would be quite straightforward to extend TclDOM/tcl parsing routines to build new nodes in an existing document. Again, all it takes is someone with the time to do the work (hint: that's not me).

CThatcher: Additionally, there should at least be an option for parsing that allows us to control the underlying parser before parsing actually takes place. Like the handling of whitespace. In *theory* we should be treating all whitespace as is, but in practice we need to be a little more brutal than that sometimes - and, let's face it, the trim function is diabolically slow.

Steve Ball: How about submitting an RFE to the TclXML SourceForge tracker?

CThatcher: Ok, thanks Steve; I'll stop ranting and start helping. Is there a tech document on how all the DOM structures work together internally, etc., as I may look into implementing importNode myself, but I'm lazy and don't want to spend hours of trawling the source :)

Steve Ball: Hmmm... no there isn't any technical doco. I'll put that on my to-do list.


[ Category Package

Category XML ]