Version 3 of TclDOM vs tDOM

Updated 2003-06-14 11:39:30

There are two well-known packages for processing XML documents in Tcl: TclXML [L1 ] (and related packages) and tDOM. One very common question is "Which package should I use for XML processing, and why?". This page summarizes the features and differences between the two packages in order to provide a (hopefully) unbiased view.

I've started this page on the Wiki so that members of both the TclXML and tDOM projects can contribute on an equal basis.

(A table would be best here, but I don't know how to get that in Wiki)

Packages:

  • TclXML is separated into three packages: TclXML for parsing, TclDOM for tree processing, TclXSLT for transformations.
  • tDOM is a single, integrated package.

Parser implementations:

  • TclXML: Pure Tcl (no extension required), C wrappers for expat and (in v3.0) libxml2.
  • tDOM: C wrapper for expat.

DOM implementations:

  • TclDOM: Pure Tcl (no extension required), 2 C extensions: TclDOM/C and TclDOM/libxml2 (a wrapper for libxml2).
  • tDOM: C extension.

XSLT implementations:

  • TclXSLT: C wrapper for libxslt.
  • tDOM: C implementation.

TEA Compliance:

  • TclXML family: Yes.
  • tDOM: Yes.

Performance:

  • tDOM is reported to have superior runtime performance.
  • Both tDOM and libxml2/libxslt out-perform most other XSLT processors, though MSXML is reputed to also be a well-performing processor.

Parsing XML

  • TclXML: SAX-style callback API, including interposing on external entity resolution. DTD validation. Work is underway on TclXML/TclDOM v3.0 which will allow XML Schema and RelaxNG validation.
  • tDOM: ?

DOM Scripting:

  • TclDOM fairly strictly adheres to the W3C DOM API: IDL Interfaces are mapped to Tcl commands, live node lists, etc. Tree nodes are represented as "tokens" that are passed as arguments to the DOM commands.
  • tDOM is somewhat more "Tclish": Tree nodes are defined as Tcl commands. (SRB comment: last time I looked some aspects of the W3C DOM spec were not defined, such as live node lists - someone on the tDOM team may wish to correct or confirm that).

XSLT Scripting:

  • TclXSLT: Allows stylesheets to be compiled, transformations performed and reuse of the compiled stylesheet. Also allows XSLT/XPath extensions to be implemented as Tcl callbacks.
  • tDOM: ?

XPath

  • tDOM supports XPath queries. It works very fast.

Deplomyent:

  • tDOM can be used as one C library. There are tDOM modules as part of TclKit. But is not provieded by ActiveState Tcl distribution.

TV As a question from a possibly interested user (because for instance I often use a USB based inet connection which happens to only have windows drivers currently), how safe is all this COM based stuff?

-- oops, I thought this page was about COM objects, too.