amit sethi wrote:
> hi , I am new to python as well as xml . I am trying to make a program
> which
> reads an xml document reads the attributes of an element and makes a
> decision as to whether it wants to keep it the new xml file that is being
> created at the same time . Is xml.sax.xmlreader.IncrementalParser good for
> this . Can anybody give me an example as to how to use Incremental parser.

I think what you are looking for is ElementTree's iterparse() function.

http://docs.python.org/library/xml.etree.elementtree.html#functions
http://effbot.org/zone/element-iterparse.htm

Note that this will build a tree (very fast, BTW) and will let you
interact with each element it touches. Once you're done, just serialise
the resulting tree.

Stefan

_______________________________________________
XML-SIG maillist  -  XML-SIG@python.org
http://mail.python.org/mailman/listinfo/xml-sig

Reply via email to