[Expat-discuss] expat and compressed xml

gilbert F. gilbertff at gmail.com
Wed Jan 13 01:10:38 CET 2010


just a quick question: can Expat handle xml file in .gz format?

Thanks.



On Tue, Jan 12, 2010 at 4:27 PM, Dan Nicholson <dbn.lists at gmail.com> wrote:

> On Tue, Jan 12, 2010 at 2:37 PM, gilbert F. <gilbertff at gmail.com> wrote:
> > Hello,
> >
> > Here is a quick question about parsing xml .gz file. Here is what I
> > did. With the following script
> >
> > req = urllib2.Request(query_url)
> > xml_file = urllib2.urlopen(req).read()
> >
> > I downloaded a compressed xml file.  The file has a suffix of ".gz".
> >
> > Now I used
> >
> > p = xml.parsers.expat.ParserCreate()
> > p.ParseFile(xml_file)
>
> I think you just want Parse instead of ParseFile since you've already
> read the data into a buffer.
>
>
> http://docs.python.org/library/pyexpat.html#xml.parsers.expat.xmlparser.Parse
>
> --
> Dan
>


More information about the Expat-discuss mailing list