ANN: Amara XML Toolkit 0.9.0

Uche Ogbuji uche.ogbuji at
Thu Dec 23 00:09:12 CET 2004

Amara XML Toolkit is a collection of Pythonic tools for XML data
binding.  Not just tools
that happen to be written in Python, but tools built from the ground
up to use Python idioms and take advantage of the many advantages
of Python over other programming languages.

Amara builds on 4Suite, but whereas 4Suite focuses more on literal
implementation of XML standards in Python, Amara adds a much more
Pythonic face to these capabilities.

Amara provides tools you can trust to conform with XML standards
without losing the familiar Python feel.

The components of Amara are:

* Bindery: data binding tool (fancy way of saying: a very Pythonic XML
* Scimitar: implementation of the ISO Schematron schema language for
            converts Schematron files to Python scripts
* domtools: set of tools to augment Python DOMs
* saxtools: set of tools to make SAX easier to use in Python

There's a lot in Amara, but here are highlights:

Amara Bindery: XML as easy as py

Based on the retired project Anobind, but updated to use SAX rather than
to create bindings.  Bindery reads an XML document and returns a data
structure of Python objects corresponding to the vocabulary used in the
XML document, for maximum clarity.

Bindery turns the document

  <python spam="eggs">What do you mean "bleh"</python>
  <python ministry="abuse">But I was looking for argument</python>

Into a set of objects such that you can write


In order to get the value "eggs" or


In order to get the value "But I was looking for argument".

There are other such tools for Python, and what makes Anobind unique is
that it's driven by a very declarative rules-based system for binding
XML to the Python data.  You can register rules that are triggered by
XPattern expressions specialized binding behavior.  It includes XPath
support and is very efficient, using SAX to generate bindings.

Scimitar: exceptional schema language for an exceptional programming

Merged in from a separate project, Scimitar is an implementation of ISO
Schematron that compiles a Schematron schema into a Python validator

You typically use scimitar in two phases.  Say you have a schematron
schema schema1.stron and you want to validate multiple XML files
against it, instance1.xml, instance2.xml, instance3.xml.

First you run schema1.stron through the scimitar compiler script, schema1.stron

A file, is generated and can be used to validate XML

python instance1.xml

Which emits a validation report.

Amara DOM Tools: giving DOM a more Pythonic face

DOM came from the Java world, hardly the most Pythonic API possible.
Some DOM-like implementations such as 4Suite's Domlettes mix in some
Pythonic idiom. Amara DOM Tools goes even further.

Amara DOM Tools features pushdom, similar to xml.dom.pulldom, but
easier to use.  It also includes Python generators-based tools for
DOM processing.  And a function to return an XPath location for
any DOM node.

Amara SAX Tools: SAX without the brain explosion

Tenorsax (amara.saxtools.tenorsax) is a framework for "linerarizing" SAX
so that it flows more naturally, and needs a lot less state machine


Amara is open source, provided under the 4Suite variant of the Apache
license.  See the file COPYING for details.


Amara requires Python 2.3 or more recent and 4Suite 1.0a3 or more
recent.  Make sure these are installed, unpack Amara to a convenient
location and run

python install

Uche Ogbuji                                    Fourthought, Inc.
Use CSS to display XML -
Full XML Indexes with Gnosis -
Be humble, not imperial (in design) - 1.0 -
Use Universal Feed Parser to tame RSS -
Default and error handling in XSLT lookup tables -
A survey of XML standards -
The State of Python-XML in 2004 -

More information about the Python-announce-list mailing list