xml.sax module documentation
shendry at usa.capgemini.com
Fri Nov 10 15:45:19 CET 2000
Thank you. That clears things up.
Slamet Hendry, shendry at usa.capgemini.com
From: Paul Prescod [mailto:paulp at ActiveState.com]
Sent: Thursday, November 09, 2000 5:25 PM
To: S. Hendry
Cc: python-list at python.org
Subject: Re: xml.sax module documentation
"S. Hendry" wrote:
> 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.
Unless you have performance constraints, you may find the DOM easier to
use and (for now) more fully documented. It's easier to use because you
have the entire tree available at one time and you can navigate around
however you want. Also, it uses a more traditional Python coding
structure instead of a callback structure.
Here's how you dould do it with the DOM:
> if PO.Approver = "John Smith":
> special_discount = 10
import xml.dom.minidom as minidom
data = """
document = minidom.parseString( data )
po = document.getElementsByTagName("PO")
approver = po.getElementsByTagName("Approver")
text = approver.childNodes.nodeValue
More information about the Python-list