xml.sax module documentation

S. Hendry shendry at usa.capgemini.com
Thu Nov 9 23:55:43 CET 2000


>I'm new to programming, but have successfully created a few working python
>codes.  Now I need to process XML files as an input to my program (my data
>is in xml format).  However, reading the Python documentation and/or source
>codes on xml.sax (or any xml module) gives me headache.  It is as-if they
>were written so newbies cannot understand them (I'm sure it's not
>intentional).  Could anyone point me to good articles / docs that can help
>me understand how to use the xml.sax modules please.  Working examples
would
>be a Godsend, if you don't mind sharing.
>
>I use ActiveState's Python 2.0 (win95).  Many many thanks in advance.

Actually I should be more specific.  I may be confused what a parser is.
Maybe if I understand this, it will help me read the docs and available
articles better.

Here's what I thought.  I have a data file, for example:
....
<PO>
  <POnum>123</POnum>
  <Approver>John Smith</Approver>
  <Items>
    <Num>1</Num>
      <SKU>34A</SKU>
      <Qty>10</Qty>
    <Num>2</Num>
... etc, etc ...

I was under the impression that I can use a parser to process the data file,
so I can check, for example:
...
if PO.Approver = "John Smith":
   special_discount = 10
...

Am I far off?  If not, then how do I use the xml modules to do what I intend
to do?  Thanks in advance.

- Slamet





More information about the Python-list mailing list