pyxie (version 1.08) | index /scisoft/users/svensson/develop/dna/xsd/python/pyxie.py |
Pyxie
An Open Source XML processing library for Python
The Pyxie Project
http://www.pyxie.org
Disclaimer
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL PROPYLON OR ITS CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
http://www.pyxie.org
XML Processing with Python
Prentice Hall
Sean Mc Grath
Change Log:
Version 1.08 - 27 Aug 2001 (Derek Higgins)
Changed the functions WalkElements and WalkData to call the appropriate function
upon the end of each element once and only once.
(Thanks to Rob van Wees for the bug report)
Version 1.07 - 2 Aug 2001 (Derek Higgins)
Change to escape backslashes in the content properly
(Thanks to John Cowan for pointing out the problem)
Version 1.06 - 8 Feb 2001
Support for Python 2.0 added. In Python 2.0, the pyexpat module has been renamed
to expat. Pyxie now tries to import pyxepat, and if that failed, imports
expat. Should now would with Python 1.5.x and 2.0
(Thanks Tim (and some others whose name I forget, sorry.))
Version 1.05 - 24 October 2000
Changed StartElementHandler to cope with the more recent versions
of pyexpat that use a dictionary rather than a list to represent
attributes (thanks John)
Version 1.01 - 16 March 2000
xDispatch.Dispatch bug fixed (processing instructions) (Thanks Chris)
xTree.PasteDown bug fixed (Thanks Noel)
Version 1.02 - 7 April 2000
Added Envelope function based on a feature request from Stuart
Hungerford. (Thanks Stuart).
Version 1.03 - 1 August 2000
Fixed bug with PIs (Thanks John)
Version 1.04 - 3 August 2000
Fixed bug in and improved structure of NWS (Thanks John)
Introduction
------------
The Pyxie library provides facilities for processing XML. The library
uses a simple notation to capture the information generated by XML
parsers known as PYX.
PYX is a line oriented notation in which the first character serves
to specify what type of parsing event the line represents:
--------------------------
First Parsing
Character Event
--------------------------
( Start-tag
A Attribute
) End-tag
- Data
? Processing
Instruction
--------------------------
Line ends and tabs occuring in data or attribute lines are escaped
to "" followed by "n" and "" followed by "t" respectively.
Any process that generates information in PYX can be
used as a data source for this library - relational databases,
HTML parsers, SGML parsers, XML parsers, latex parsers... whatever.
Facilities provided include:
Tree-driven XML Processing (see xTree and related classes)
Event-driven XML Processing (see the xDispatch class)
Event-driven XML Processing with full Tree access
(see the Dispatch method of xTree)
Sparse Trees - (see demo in test harness)
A SAX to PYX driver to generate PYX from any SAX parser
An SGML-like white space normalization function
A Pyxie Exception class
PYX encoder and decoder functions for handling escaped
line ends/tabs
Tree driven XML Processing
---------------------------
The xTree class provides:
Navigational methods for moving current position around
a tree structure
Cut and Paste facilities
Serialization to XML via repr
Node list assembly methods such as Ancestors, Descendants etc.
Tree walking with call-backs to methods named after element
type names
A "Pythonic" tree walking facility using a simple Python for loop
An event dispatch facility (Dispatch) which will can call handler
methods in arbitrary Python classes
Event-driven XML Processing
---------------------------
The xDispatch class provides:
Ancestor information available in a simple list structure
Callbacks to methods named after element type names
e.g. start_foo, end_foo
Default method handlers default_start and default_end
Callback for data content (the characters method)
Supports sparse tree building by allowing dispatched events
to be pushed back onto the PYX stream (see demo in test harness)
The xDispatchMultiplexor class provides the ability to have
multiple event-driven "clients" processing a PYX event stream
in parallel.
See also the Pyxie project home page at http://www.pyxie.org.
There is a Pyxie mailing list. For more information, send an e-mail
with just the word 'help' as subject or body to:
pyxie-request@starship.python.net
Modules | ||||||
|
Classes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Functions | ||
|
Data | ||
__version__ = '1.08' |