a few more questions on XML and python

Rajarshi Guha rxg218 at psu.edu
Thu Jan 3 18:06:28 EST 2002


Hi,
  thanks for the nice pointers regrding XML and python. I have another 
newbie question - I'm trying to get information out of a CML (Chemical 
Markup Language) file which is a subset of XML. My query is that using 
xml.parsers.expat I can get a loist of tags and values etc. I

How can I  indicate to the parser that if say it comes upon a tag like 
<coordinate> it should call a certain handler to process the coordinate 
data.

Or am I supposed to just do the handling by extractin the information 
provided by expat. If so is there any type of 'hook' system where I can 
plug in my handlers.

I'm a little confused as to how expat is supposed to handle an arbitrary 
XML file where the tags could be describing anything.

As you can see I'm pretty confused :(

TIA

-- 
-------------------------------------------------------------------
Rajarshi Guha                  | email: rajarshi at presidency.com
417 Davey Laboratory           | web  : www.rajarshi.outputto.com 
Department of Chemistry        | ICQ  : 123242928
Pennsylvania State University  | AIM  : LoverOfPanda
-------------------------------------------------------------------
GPG Fingerprint: DCCB 4D1A 5A8B 2F5A B5F6  1F9E CDC4 5574 9017 AF2A 
Public Key     : http://pgp.mit.edu/
-------------------------------------------------------------------
Mathematics consists of proving the most obvious thing
in the least obvious way.
                -- George Polya




More information about the Python-list mailing list