Re: expat and compressed xml

Thomas Younger <[email protected]> Tue, 12 Jan 2010 16:20:28 -0800
Newsgroups gmane.text.xml.expat.general
Message-ID <4182B254F019D440A86CF7875FD9B9E0783968A686@robin.questercorp.local>
No, not directly.

An easy solution would be to pipe the xml.gz file through zcat.

________________________________________
From: [email protected] [[email protected]] On Behalf Of gilbert F. [[email protected]]
Sent: Tuesday, January 12, 2010 4:10 PM
To: Dan Nicholson
Cc: [email protected]
Subject: Re: [Expat-discuss] expat and compressed xml

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

Thanks.



On Tue, Jan 12, 2010 at 4:27 PM, Dan Nicholson <[email protected]> wrote:

> On Tue, Jan 12, 2010 at 2:37 PM, gilbert F. <[email protected]> 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
>
_______________________________________________
Expat-discuss mailing list
[email protected]
http://mail.libexpat.org/mailman/listinfo/expat-discuss