DOM Binding For Tcl

TclDOM

Steve Ball

Explain


  
    www.explain.com.au
  

$Id: README.xml,v 1.5 2004/07/11 11:48:57 balls Exp $

Revision History
Revision 3.1

Table of Contents

Installation
Dependencies
Pure-Tcl Installation
Compiled Installation
Usage

This package provides a DOM binding for Tcl. It provides one of the following implementations:

See the TclXML website for more information on XML support for Tcl.

Contact Steve Ball for information about this release.

Installation

How you install the package depends on which implementation you require.

Dependencies

All in cases, the following packages must be installed before attempting to install TclDOM.

Tcllib

http://dev.scriptics.com/software/tcllib/

In order for the Tcl-only parser to resolve external entities, the tcllib package must be installed.

Be sure to get a version which includes the uri package. Version 1.2 or better is recommended.

The latest CVS snapshot may be found at the SourceForge project page.

TclXML

First install TclXML version 3.1.

Note

You must install the same numbered version as this package, ie. 3.1.

Pure-Tcl Installation

no compilation required

The install.tcl script will install the pure-Tcl DOM implementation. Run it using wish, eg.

wish install.tcl

Note

If Tcl/Tk has been configured correctly on your system, you should be able to simply double-click the script

If the pure-Tcl parser is good enough for you, then read no further.

Compiled Installation

If you need the performance of a compiled DOM implementation, then you have three options:

  • TclDOM/libxml2

  • TclDOM/C (a.k.a. TclDOMPro)

  • tDOM (different API to TclDOM, but similar functionality)

Installing TclDOM/libxml2

Additional Dependencies

In order to build TclDOM/libxml2, first install the TclXML package with libxml2 support - ie. TclXML/libxml2.

Unix/Linux

You must have Tcl/Tk version 8.2 or better installed on your system. Tcl/Tk 8.3 or better is recommended.

  1. Unpack the TclDOM distribution and cd into the tcldom-3.1/src-libxml2 directory.

  2. Run the configure script, with the [--prefix] and [--enable-threads] switches (the latter only if Tcl has been built with threads enabled).

    Note

    If libxml2 was installed in a non-standard location you might have to add the [--with-libxml2-include] and [--with-libxml2-lib] switches.

    Note

    On Windows the iconv library is required too. See www.fh-frankfurt.de/~igor/projects/libxml/ for either precompiled binaries, or a link to the sources. The relevant options are [--with-iconv-include] and [--with-iconv-lib].

    For example, on my system I have Tcl 8.4 installed in /usr/local/tcl8.4 so I would use the command:

    ./configure --prefix=/usr/local/tcl8.4 --enable-threads --with-libxml2-include=/usr/local/include --with-libxml2-lib=/usr/local/lib
  3. make
  4. make install

    You may have to do this as root

Windows (MS VC++)

You must have Tcl/Tk version 8.2 or better installed on your system. Tcl/Tk 8.3 or better is recommended.

You must have TclXML/libxml2 installed, so you will have already downloaded and unpacked the libxml2 distribution.

If you have a TEA build environment, just use the normal configure/make/make install pattern.

Alternatively, the win subdirectory contains a makefile.vc file for Visual Studio C++ v6.0. This makefile builds the TclDOM/libxml2 implementation. In a Command Prompt window set up your environment so that nmake is on the path (by running VCVARS32.BAT), then type the following:

nmake -f makefile.vc TCLDIR=C:\Path\To\Tcl INSTALLDIR=C:\Path\To\Tcl LIBZDIR=C:\Path\To\libz LIBICONVDIR=C:\Path\To\libiconv LIBXML2DIR=C:\Path\To\libxml2 TCLXMLDIR=..\tclxml

As an example, on my system I have Tcl installed in C:\Tcl and the libxml2 binaries unpacked in the directory C:\gnome. The TCLXMLDIR variable defaults to ..\tclxml. Accordingly, I would use the following command line:

nmake -f makefile.vc TCLDIR=C:\Tcl INSTALLDIR=C:\Tcl LIBZDIR=C:\gnome\zlib-1.1.4.win32 LIBICONVDIR=C:\gnome\libiconv-1.9.1.win32 LIBXML2DIR=C:\gnome\libxml2-2.6.7.win32

Install the package by appending 'install' to the command line used above, for example:

nmake -f makefile.vc TCLDIR=C:\Path\To\Tcl INSTALLDIR=C:\Path\To\Tcl LIBZDIR=C:\Path\To\libz LIBICONVDIR=C:\Path\To\libiconv LIBXML2DIR=C:\Path\To\libxml2 TCLXMLDIR=..\tclxml install

Usage

See reference documentation.