From haoniukun at gmail.com Mon Jan 11 09:19:33 2010 From: haoniukun at gmail.com (Kun Niu) Date: Mon, 11 Jan 2010 16:19:33 +0800 Subject: [Expat-discuss] Can expat add "write xml file" support? Message-ID: <4B4ADF15.1030100@gmail.com> Dear all, I'm trying to use expat for my xml file manipulation library. But I find that it doesn't support writing to an XML file. I wonder if the developer will have a plan to provide such an API. Thanks for your delligent work. Regards, Kun From robert.bielik at xponaut.se Mon Jan 11 09:24:21 2010 From: robert.bielik at xponaut.se (Robert Bielik) Date: Mon, 11 Jan 2010 09:24:21 +0100 Subject: [Expat-discuss] Can expat add "write xml file" support? In-Reply-To: <4B4ADF15.1030100@gmail.com> References: <4B4ADF15.1030100@gmail.com> Message-ID: <4B4AE035.7060105@xponaut.se> Kun Niu skrev: > Dear all, > I'm trying to use expat for my xml file manipulation library. But I find > that it doesn't support writing to an XML file. I wonder if the > developer will have a plan to provide such an API. Very unlikely. Expat focuses on fast XML parsing, you'll have to look to other solutions for writing XML, and there are many... /R From haoniukun at gmail.com Mon Jan 11 10:26:14 2010 From: haoniukun at gmail.com (Kun Niu) Date: Mon, 11 Jan 2010 17:26:14 +0800 Subject: [Expat-discuss] Can expat add "write xml file" support? In-Reply-To: <4B4AE035.7060105@xponaut.se> References: <4B4ADF15.1030100@gmail.com> <4B4AE035.7060105@xponaut.se> Message-ID: <4B4AEEB6.8020703@gmail.com> Really appreciate your reply. I think that expat is one of the best API on AIX 6.10 platform. But now I'll try xerces first. Robert Bielik wrote: > Kun Niu skrev: >> Dear all, >> I'm trying to use expat for my xml file manipulation library. But I find >> that it doesn't support writing to an XML file. I wonder if the >> developer will have a plan to provide such an API. > > Very unlikely. Expat focuses on fast XML parsing, you'll have to look > to other solutions for writing > XML, and there are many... > > /R > > _______________________________________________ > Expat-discuss mailing list > Expat-discuss at libexpat.org > http://mail.libexpat.org/mailman/listinfo/expat-discuss From aleix at member.fsf.org Mon Jan 11 11:39:30 2010 From: aleix at member.fsf.org (=?UTF-8?Q?Aleix_Conchillo_Flaqu=C3=A9?=) Date: Mon, 11 Jan 2010 11:39:30 +0100 Subject: [Expat-discuss] Can expat add "write xml file" support? In-Reply-To: <4B4AEEB6.8020703@gmail.com> References: <4B4ADF15.1030100@gmail.com> <4B4AE035.7060105@xponaut.se> <4B4AEEB6.8020703@gmail.com> Message-ID: On Mon, Jan 11, 2010 at 10:26, Kun Niu wrote: > Really appreciate your reply. > I think that expat is one of the best API on AIX 6.10 platform. But now I'll > try xerces first. > You can try SCEW (a simple expat wrapper) which allows writing to files, memory buffers, etc. And the footprint is small as well. Aleix From gilbertff at gmail.com Tue Jan 12 23:37:47 2010 From: gilbertff at gmail.com (gilbert F.) Date: Tue, 12 Jan 2010 15:37:47 -0700 Subject: [Expat-discuss] expat and compressed xml Message-ID: 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) The last line gave Traceback (most recent call last): File "", line 1, in TypeError: argument must have 'read' attribute xml_file is not a file. It is a string therefore it gave an error. Anybody knows how to uncompress the downloaded file? I know that "gunzip" can be used to uncompress ".gz" files, however I do not know how to get the uncompressed result. Any help? Thanks so much. From tyounger at questertangent.com Tue Jan 12 23:51:59 2010 From: tyounger at questertangent.com (Thomas Younger) Date: Tue, 12 Jan 2010 14:51:59 -0800 Subject: [Expat-discuss] expat and compressed xml In-Reply-To: References: Message-ID: <4182B254F019D440A86CF7875FD9B9E0783968A685@robin.questercorp.local> zcat ________________________________________ From: expat-discuss-bounces+tyounger=questertangent.com at libexpat.org [expat-discuss-bounces+tyounger=questertangent.com at libexpat.org] On Behalf Of gilbert F. [gilbertff at gmail.com] Sent: Tuesday, January 12, 2010 2:37 PM To: expat-discuss at libexpat.org Subject: [Expat-discuss] expat and compressed xml 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) The last line gave Traceback (most recent call last): File "", line 1, in TypeError: argument must have 'read' attribute xml_file is not a file. It is a string therefore it gave an error. Anybody knows how to uncompress the downloaded file? I know that "gunzip" can be used to uncompress ".gz" files, however I do not know how to get the uncompressed result. Any help? Thanks so much. _______________________________________________ Expat-discuss mailing list Expat-discuss at libexpat.org http://mail.libexpat.org/mailman/listinfo/expat-discuss From dbn.lists at gmail.com Wed Jan 13 00:27:36 2010 From: dbn.lists at gmail.com (Dan Nicholson) Date: Tue, 12 Jan 2010 15:27:36 -0800 Subject: [Expat-discuss] expat and compressed xml In-Reply-To: References: Message-ID: <91705d081001121527g67e71b1cm71f46f5f66642a69@mail.gmail.com> On Tue, Jan 12, 2010 at 2:37 PM, gilbert F. 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 From gilbertff at gmail.com Wed Jan 13 01:10:38 2010 From: gilbertff at gmail.com (gilbert F.) Date: Tue, 12 Jan 2010 17:10:38 -0700 Subject: [Expat-discuss] expat and compressed xml In-Reply-To: <91705d081001121527g67e71b1cm71f46f5f66642a69@mail.gmail.com> References: <91705d081001121527g67e71b1cm71f46f5f66642a69@mail.gmail.com> Message-ID: just a quick question: can Expat handle xml file in .gz format? Thanks. On Tue, Jan 12, 2010 at 4:27 PM, Dan Nicholson wrote: > On Tue, Jan 12, 2010 at 2:37 PM, gilbert F. 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 > From tyounger at questertangent.com Wed Jan 13 01:20:28 2010 From: tyounger at questertangent.com (Thomas Younger) Date: Tue, 12 Jan 2010 16:20:28 -0800 Subject: [Expat-discuss] expat and compressed xml In-Reply-To: References: <91705d081001121527g67e71b1cm71f46f5f66642a69@mail.gmail.com>, Message-ID: <4182B254F019D440A86CF7875FD9B9E0783968A686@robin.questercorp.local> No, not directly. An easy solution would be to pipe the xml.gz file through zcat. ________________________________________ From: expat-discuss-bounces+tyounger=questertangent.com at libexpat.org [expat-discuss-bounces+tyounger=questertangent.com at libexpat.org] On Behalf Of gilbert F. [gilbertff at gmail.com] Sent: Tuesday, January 12, 2010 4:10 PM To: Dan Nicholson Cc: expat-discuss at libexpat.org 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 wrote: > On Tue, Jan 12, 2010 at 2:37 PM, gilbert F. 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 Expat-discuss at libexpat.org http://mail.libexpat.org/mailman/listinfo/expat-discuss From michal at molhanec.net Wed Jan 13 02:22:12 2010 From: michal at molhanec.net (Michal Molhanec) Date: Wed, 13 Jan 2010 02:22:12 +0100 Subject: [Expat-discuss] expat and compressed xml In-Reply-To: References: Message-ID: <20100113022212.00007f8a@unknown> On Tue, 12 Jan 2010 15:37:47 -0700 "gilbert F." 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() You can do: from StringIO import StringIO from gzip import GzipFile p.ParseFile(GzipFile(fileobj=StringIO(xml_file)) From michael.s.gilbert at gmail.com Mon Jan 18 18:28:35 2010 From: michael.s.gilbert at gmail.com (Michael Gilbert) Date: Mon, 18 Jan 2010 12:28:35 -0500 Subject: [Expat-discuss] Python improvements to expat In-Reply-To: <20100118115428.725374c3.michael.s.gilbert@gmail.com> References: <20100118115428.725374c3.michael.s.gilbert@gmail.com> Message-ID: <20100118122835.496c77d4.michael.s.gilbert@gmail.com> Hi, Mozilla has made some real changes to expat. Would it make sense to merge any of their modifications? See the attached diff. Best wishes, Mike -------------- next part -------------- A non-text attachment was scrubbed... Name: expat-mozilla.diff Type: text/x-diff Size: 17076 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: moz_extensions.c Type: text/x-csrc Size: 5524 bytes Desc: not available URL: From peterv at propagandism.org Tue Jan 19 11:41:46 2010 From: peterv at propagandism.org (Peter Van der Beken) Date: Tue, 19 Jan 2010 11:41:46 +0100 Subject: [Expat-discuss] Python improvements to expat In-Reply-To: <20100118122835.496c77d4.michael.s.gilbert@gmail.com> References: <20100118115428.725374c3.michael.s.gilbert@gmail.com> <20100118122835.496c77d4.michael.s.gilbert@gmail.com> Message-ID: <4B558C6A.60201@propagandism.org> On 18/01/10 18:28, Michael Gilbert wrote: > Mozilla has made some real changes to expat. Would it make sense to > merge any of their modifications? See the attached diff. I doubt it, we've been pretty good about upstreaming patches where it made sense. I don't think there are any left that would be of interest to others. Are you wondering about anything in particular? Peter From michael.s.gilbert at gmail.com Mon Jan 18 17:54:28 2010 From: michael.s.gilbert at gmail.com (Michael Gilbert) Date: Mon, 18 Jan 2010 11:54:28 -0500 Subject: [Expat-discuss] Python improvements to expat Message-ID: <20100118115428.725374c3.michael.s.gilbert@gmail.com> Hi, Python has made some minor improvements to expat. Would it make sense to merge any of their changes? See the attached diff. Note that a lot of the differences (i.e. using characters instead of defines and losing support for large files) are because they have version 2.0.0 of expat. I'm not sure if any of the other changes would be useful. Best wishes, Mike -------------- next part -------------- A non-text attachment was scrubbed... Name: python-expat.diff Type: text/x-diff Size: 26762 bytes Desc: not available URL: From michael.s.gilbert at gmail.com Mon Jan 18 18:08:26 2010 From: michael.s.gilbert at gmail.com (Michael Gilbert) Date: Mon, 18 Jan 2010 12:08:26 -0500 Subject: [Expat-discuss] Python improvements to expat In-Reply-To: <20100118115428.725374c3.michael.s.gilbert@gmail.com> References: <20100118115428.725374c3.michael.s.gilbert@gmail.com> Message-ID: <20100118120826.f1e1883b.michael.s.gilbert@gmail.com> On Mon, 18 Jan 2010 11:54:28 -0500 Michael Gilbert wrote: > Hi, > > Python has made some minor improvements to expat. Would it make sense to > merge any of their changes? See the attached diff. > > Note that a lot of the differences (i.e. using characters instead of > defines and losing support for large files) are because they have > version 2.0.0 of expat. I'm not sure if any of the other changes would > be useful. I should have done a diff with 2.0.0 to begin with. It turns out that the only difference is that they include pyexpatns.h, which just appends 'PyExpat_' to expat's symbols. Sorry for the noise. Mike From dbyron at dbyron.com Tue Jan 26 02:32:50 2010 From: dbyron at dbyron.com (David Byron) Date: Mon, 25 Jan 2010 17:32:50 -0800 Subject: [Expat-discuss] format specifiers for XML_Size, XML_Index Message-ID: Please consider applying this patch to provide format specifiers for XML_Size and XML_Index. Thanks. -DB -------------- next part -------------- A non-text attachment was scrubbed... Name: format_specifiers.patch Type: application/octet-stream Size: 699 bytes Desc: not available URL: