Amara 2 will target Python 2.5 and 2.6. There will be an Amara 3.0 branch targeting the big changes in Python 3K.

Module layout

The top-level namespace is "amara", not "amara2" because a namespace is not a great place for versioning.

This might cause some pain for those who want to use Amara 1.x as well, especially while Amara 2 is not yet ready for production, but long-term it's the right thing to do. Tools such as virtualenv can provide more systematic relief for such users.

+ amara (xml core libraries at this level, including core parsing API ("tree"--a very low level infoset node data model))
| (includes reader.py -- Saxlette)
|
+--+ lib
|  |
|  +-- iri
|  |
|  +-- inputsource
|
+-- writer (General purpose writers.  essentially the opposites of Saxlette.  includes output params)
|
+-- dom (Python DOM binding: builds on amara.tree)
|
+-- bindery (Dynamic data binding: builds on amara.tree)
|
+-- xpath (XPath impl: operates on amara.tree and derivatives)
|
+-- xslt (XSLT impl: operates on amara.tree and derivatives)
|  |
|  +-- elements (the element classes)
|  |
|  +-- readers (interpretation of XML structures)
|  |
|  +-- xpattern (XSLT patterns)
|  |
|  +-- extensions (functions and elements)
|  |
|  +-- functions (core functions)
|  |
|  +-- exslt
|  |
|  +-- writers (specializations of writers for XSLT)
|
+-- xupdate
|
+-- schematron
|
+-- relaxng

Sample imports:

Input sources

Loosely based on LSInput, and represents one specific input source, which is one of the following:

You create an inputsource instance as follows:

   1 from amara.lib import inputsource
   2 
   3 #From URI
   4 isrc = inputsource("http://xmlhack.com/read.php?item=1560")
   5 
   6 # From string:
   7 isrc = inputsource("<spam>eggs</spam>", baseiri=u"http://spam.com/base")
   8 
   9 # From byte stream:
  10 f = open('test.xml')
  11 isrc = inputsource(f, baseiri=u"file:///spam/test.xml")
  12 
  13 # From file:
  14 isrc = inputsource('test.xml')
  15 

inputsource object attributes

Custom resolution

You can provide your own custom entity resolution (e.g. to handle non-URL IRI types) by subclassing inputsource, or equivalent device. Generally you just need to override the _resolve() entity. The resolve() method is smart enough to use the same class for new inputsources.

Printers and writers

Note:

Domlette node families

Amara2/Architecture (last edited 2009-07-28 04:31:10 by UcheOgbuji)