TclExpat: A Tcl interface to expat. Steve Ball, Zveno Pty Ltd. http://www.zveno.com/ mailto:Steve.Ball@zveno.com This subdirectory provides a Tcl interface to the expat library. It creates a Tcl package, called "expat", which defines a single new Tcl command "expat". COMPILATION Unfortunately, compilation is not yet automatic. You must choose whether you want to compile under tcl 8.0 or 8.1. Edit the Makefile in this directory and set the various definitions to match your Tcl installation's tclConfig.sh script. Then type `make' to build the shared library. TclExpat is known to compile on HP/UX, Solaris and Linux. There should be no problems compiling on other platforms. MANIFEST tclexpat.c Extension source xmlwf8.0 Well-formedness checker. These output the normalised document xmlwf8.1 tester test suite. Run these to check TclExpat's functions. test-continue.tcl test-break.tcl test-error.tcl USAGE The package is loaded using: package require expat 1.0 The expat command is used to create a parser instance: expat myparser ?options? A Tcl command is created for the parser instance using the supplied name. This command is then used to invoke parser functions. Valid parser methods are: myparser parse data Parses XML data. expat will invoke callbacks for various document features, such as element start, element end, character data, etc. myparser reset Prepares for parsing another document. myparser configure option value ?option value ...? Configures options for the parser. Valid options include: -final boolean Whether there is data still to come. -baseurl URL Used to resolve relative URL references. -elementstartcommand script script name attributelist -elementendcommand script script name -characterdatacommand script script data -processinginstructioncommand script script name data -defaultcommand script -unparsedentitydeclcommand script -notationdeclcommand script -externalentitycommand script -unknownencodingcommand script These are the callback scripts for the various document features. Arguments are appended as appropriate for the feature, as shown, and then the string is evaluated at the global level. If the script returns an error status then further processing of callbacks is aborted and the parser also returns an error. If the script calls the break command then further processing of callbacks is suppressed and the parser returns (with no error). If the script calls the continue command then callbacks for the current element are skipped. Callback invocation will resume for the following element. TODO (Volunteers needed!) Automate build process using autoconf or TEXI. Expand test suite to cover all TclExpat functions. Improve external entity handling.