Home | Docs | Availability | CVS | Summary | Discussion | News | Related | 

S-exp-based XML parsing/query/conversion

Get S-exp-based XML parsing/query/conversion at
   SourceForge.net. Fast, secure and Free Open Source software downloads

This project offers tools to inter-convert between an angular-bracket and a more efficient S-expression-based notations for markup documents, and to manipulate and query xML data in Scheme. The main components of the project are SSAX, SXML, SXPath, and SXSLT.

A SSAX functional XML parsing framework consists of a DOM/SXML parser, a SAX parser, and a supporting library of lexing and parsing procedures. The procedures in the package can be used separately to tokenize or parse various pieces of XML documents. The framework supports XML Namespaces, character, internal and external parsed entities, attribute value normalization, processing instructions and CDATA sections. The package includes a semi-validating SXML parser: a DOM-mode parser that is an instantiation of a SAX parser (called SSAX).

SSAX is a full-featured, algorithmically optimal, pure-functional parser, which can act as a stream processor. SSAX is an efficient SAX parser that is easy to use. SSAX minimizes the amount of application-specific state that has to be shared among user-supplied event handlers. SSAX makes the maintenance of an application-specific element stack unnecessary, which eliminates several classes of common bugs. SSAX is written in a pure-functional subset of Scheme. Therefore, the event handlers are referentially transparent, which makes them easier for a programmer to write and to reason about. The more expressive, reliable and easier to use application interface for the event-driven XML parsing is the outcome of implementing the parsing engine as an enhanced tree fold combinator, which fully captures the control pattern of the depth-first tree traversal.

SXML is an abstract syntax tree of an XML document. SXML is also a concrete representation of the XML Infoset in the form of S-expressions.

SXSLT is a manipulation language for XML and SXPath is an XPath-conforming XML query language. Both languages internally rely on SXML as a representation of the XML Infoset.


Documentation and tutorials

SXML Tools Tutorial by Dmitry Lizorkin:

Main SSAX/SXML page:

XML Matters: Investigating SXML and SSAX: Manipulating XML in the Scheme programming language
by David Mertz, Ph.D. IBM developerWorks article

Authoring dynamic websites with SXML by Peter Bex:

Detailed introduction, motivation and real-life case-studies of SSAX, SXML, SXPath and SXSLT.
The paper and the complementary talk presented at the International Lisp Conference 2002.

The derivation of the SSAX API and the comparison of SSAX with other functional-style XML parsers and with the Expat
A transcript of a presentation at PADL 2002, the 4th International Symposium on Practical Aspects of Declarative Languages.
The paper (Copyright of Springer-Verlag) is available at:

SXML tutorial (in Japanese)

SXML, SSAX, and SXML Transforms. Presentation, notes, and exercises
4th December 2002 and 8th January 2003 meetings of the Scheme UK group [by Noel Welsh and Matt Jadud]

Advanced SXLST tutorial
This file describes common patterns of SXSLT on an interesting example. We demonstrate higher-order tags, pre-order and post-order transformations, re-writing of SXML elements in regular and special ways, context-sensitive applications of re-writing rules, and reflection. Although the file is technically a Scheme source code, it is actually a tutorial. Of 357 lines in the file, 241 are comments and 24 are just blank lines. August 2003.

SXSLT: Manipulation Language for XML
A transcript of a presentation at PADL 2003. The talk introduces SXSLT and compares it with XSLT. Our experience and user comments show that SXSLT is expressive and easy to use. We argue that this outcome is a consequence of SXSLT providing right abstractions for XML transformations, of being higher-order, declarative and extensible.


SXML-related projects

Sedna - a Native XML DBMS
Since version 0.2, Sedna provides the representation of query results in SXML

SXPath library: an implementation of XPath. The SXML query library.
SXPointer: an SXPath-based implementation of XPointer [by Kirill Lisovsky]

SXLink: An implementation of W3C XLink [by Dmitry Lizorkin]

STX: a compiler for a subset of XSLT and an embedding of XSLT into Scheme [by Kirill Lisovsky]

DataGuides: A descriptive database schema for XML/SXML data [by Kirill Lisovsky]

WebIt! - An XML Framework for Scheme [by Jim Bender]

HtmlPrag: a permissive HTML parser that emits SXML [by Neil W. Van Dyke]

WebScraperHelper: simple generation of SXPath queries to extract data from (parsed) Web pages [by Neil W. Van Dyke]

sxmlcnv: XML <-> SXML SmartDoc-friendly conversion application [by Kiyoka Nishiyama]


SXML for static and dynamic websites

This page and all SXML-related pages are authored in SXML.

For more detailed explanation of these projects, see the talk at the International Lisp Conference.



The current released version of SSAX is 5.1. The whole SSAX code is in public domain.

SSAX has been tested on the following Scheme systems:
PLT Scheme, Bigloo, GambitC 4.0, Chicken, Guile, SCM, MIT Scheme 7.5.2, Scheme48, SCSH, Gauche, SISC.


SSAX download site at SourceForge:

Kirill Lisovsky's index of various SSAX distributions. Kirill has put together many of those distributions, in particular, the ones for PLT Scheme.

SSAX/SXML has been integrated into various Scheme systems and, in some cases, become part of the distribution for those systems:


CVS Tree

The CVS Tree includes the complete SSAX/SXML code, some documentation, validation tests, as well as several sample applications.

You can browse the files in the CVS tree from any web browser.

Last updated March 9, 2013

Your comments, problem reports, questions are very welcome!

Converted from SXML by SXML->HTML