Examples of using XML and Python?

Peter Hansen peter at engcorp.com
Thu Jul 19 21:56:39 EDT 2001


Mark Ainsworth wrote:
> 
> Has anyone got any simple examples of using Python and XML? The plan is to
> use XML as the data format for information files. These need to be able to
> be read, for data extraction, and also written too for modification. I am
> VERY new to this. Python is O.K. but I haven't got a clue about SAX, DOM
> etc.

I see other posts replying with useful links, so I won't try to compete
with those.  I have two points, however:

1. "Use XML as the data format for information files" seems incredibly
   redundant, or at least very vague. :)  Can you provide any more detail?
   This might let somebody provide more "targetted" examples.

2. We are using Python and XML extensively at my current employer. 
   We use XML "as the data format for information files". :-)  Actually,
   I would say we just store various kinds of data as XML.  In this 
   case, the output from a factory automation system is encoded in
   XML format for later analysis/conversion into other forms.  Printed
   reports are generated directly from the XML using FOP, which converts
   to PDF files.  We are going to add some statistical analysis
   capability as well, which will probably start by using the Python
   XML support to extract relevant data for processing, either by
   Python or by converting into spreadsheet data for processing elsewhere.

   The input data for the automation system is also stored as XML.
   In this case, it is extract using Python utilities from another
   format (Excel spreadsheets, I believe, in the current version), and
   converted to XML for consumption by the automation application.

-- 
----------------------
Peter Hansen, P.Eng.
peter at engcorp.com



More information about the Python-list mailing list