[XML-SIG] Limit XML Parsing with SAX
Henry Chan
hchan2 at stuy.edu
Tue Oct 12 02:33:05 CEST 2004
Hey there,
I'm a complete newbie to the world of XML and really python in general.
I think I only clocked about a month in python. Anyway, I was writing
this script to parse the releases off of this anime webpage. I want it
to list the 5 most recent release elements. I've written something up
using SAX as I was reading the Python/XML How-to. It works but it's
super slow. The way in which I have limited the amount of release
elements is by having a variable that increments each time a release
element is encountered. Then, it checks against the limit. If it's >=
the limit, it returns. I have that at the beginning of startElement().
It's pretty sloppy. I was hoping there would be a way to stop parsing
once this limit is hit instead of continue parsing while ignoring the
results.
-Henry
More information about the XML-SIG
mailing list