Module pyXSD
source code
PyXSD was developed in order to map XML and the related schema (XSD) files into the
programming language Python. The program builds a Pythonic representation of the XML
tree according to the specifications in the schema and raises non-fatal parser errors
whenever possible in order to help the user validate their XML document. The program
allows the user to specify transform classes, which manipulate and transform the
XML tree in various ways. The program then writes the tree back out into XML. This
program was written in order to replace many of the old tools that were written in
FORTRAN with the more modern XML format and the more modern and powerful Python
programming language. PyXSD allows users to create their own transform classes with
the help of a transform library. These classes are fairly simple to write, making the
system highly adaptable to very specific uses, as one might find in many scientific
applications; however, the program has potential uses in other fields, since XML is
widely used. The program allows the user to specify the desired transform classes,
along with their arguments and sequence of application, so the user can create
customised tools. The program can be used either as a standalone command line program
or as a library in other programs.
For more information on pyXSD, see the pyXSD website
if you haven't already.
- Creates python classes for all types defined in an XSD schema file (xml)
- Reads in a xml file and builds a new pythonic tree according to classes. This tree of instances maintains the same overall structure of the original xml document.
- Provides some xml/schema parsing with non-fatal errors in order to help the user write a valid xml document, without requiring it
- Transforms the pythonic reprsentation according to built-in and add-on 'transform' classes that the user specifies
- Sends data to a writer to write the pythonic tree back into an xml file
- Transforms allow users to easily adapt pyXSD to vast number of applications
- Provides a framework and libraries to write transform so the user can more easily write these transform functions
- Allows the user to specify the desired transform classes with arguments and the order in a file so the user can create a sort of custom tool
- Allows for transforms that can export to other formats, giving pyXSD powerful flexibility
The pythonic data tree format uses a very simple structure that allows for an easily understood API, so that users can easily manipute this tree in transforms and use the writer in other programs
Can be used as a standalone program at the command line or as a library in other programs
uses the cElementTree library for fast reading of the xml and xsd files
|
PyXSD
main class of the program that is in charge of data flow.
|
|
main()
This function is called when pyXSD is being called from the command line.
|
Imports:
sets,
sys,
traceback,
imp,
urllib,
os,
xml.etree.cElementTree,
xml.etree.ElementTree,
xml.etree.as,
elementtree.ElementTree,
elementRepresentatives.elementRepresentative.ElementRepresentative,
writers.xmlTreeWriter.XmlTreeWriter,
schemaBase.SchemaBase,
optparse.OptionParser
This function is called when pyXSD is being called from the command line.
It runs the OptionParser found under optparse in the standard library. Some
checks are performed on the data collected, and if these checks pass, it initializes
the pyXSD class.
No parameters
-
|
__author__
None
-
- Value:
'Karl Norby and Mike Summers'
|
|