Re: How to parse XML file and save results as .txt or .csv?

2015-08-19 Thread harirammanohar159
On Tuesday, 18 August 2015 22:20:32 UTC+5:30, ryguy7272  wrote:
 I am trying to parse this XML file.
 http://www.usda.gov/oce/commodity/wasde/report_format/latest-July-2015-New-Format.xml
 
 I tried a bunch of things in R, and almost got it working, but it seems like 
 there was some issue with the rows and columns being out of sync, or some 
 such thing.  Can someone here share some Python code that will parse the XML 
 file mentioned above, possibly clean up any garbage, and save the results as 
 .txt or .csv?
 
 Thanks!!

Hey,

you can use argparse or xml tree in python and you can save it any where in any 
format. its really work.. see the examples and try to figure out the 
code
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Parse xml file

2009-08-30 Thread Mag Gam
XML is a structured file. I never knew you can read it line by line
and process. iterparse()

More info on iterparse():
http://effbot.org/zone/element-iterparse.htm


On Thu, Aug 27, 2009 at 10:39 AM, Stefan Behnelstefan...@behnel.de wrote:
 loial wrote:
 Is there a quick way to retrieve data from an xml file in python 2.4,
 rather than read the whole file?

 ElementTree is available as an external package for Py2.4 (and it's in the
 stdlib xml.etree package since 2.5).

 It's pretty much the easiest way to get data out of XML files.

 If your statement rather than read the whole file was referring to the
 file size, note that the C implementation cElementTree of ElementTree is
 very memory efficient, so you might still get away with just reading the
 whole file into memory. There's also the iterparse() function which
 supports iterative parsing of an XML file and thus allows intermediate
 cleanup of used data.

 Stefan
 --
 http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


Parse xml file

2009-08-27 Thread loial
Is there a quick way to retrieve data from an xml file in python 2.4,
rather than read the whole file?



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Parse xml file

2009-08-27 Thread Balamurugan S
On Thu, Aug 27, 2009 at 2:26 PM, loialjldunn2...@googlemail.com wrote:
 Is there a quick way to retrieve data from an xml file in python 2.4,
 rather than read the whole file?

Universal Feed parser can do the job for you.
This can be imported and used in your python programs.

For more information,
http://www.feedparser.org/


-- 
Regards,

S.Balamurugan

Free the code, Free the User
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Parse xml file

2009-08-27 Thread Stefan Behnel
loial wrote:
 Is there a quick way to retrieve data from an xml file in python 2.4,
 rather than read the whole file?

ElementTree is available as an external package for Py2.4 (and it's in the
stdlib xml.etree package since 2.5).

It's pretty much the easiest way to get data out of XML files.

If your statement rather than read the whole file was referring to the
file size, note that the C implementation cElementTree of ElementTree is
very memory efficient, so you might still get away with just reading the
whole file into memory. There's also the iterparse() function which
supports iterative parsing of an XML file and thus allows intermediate
cleanup of used data.

Stefan
-- 
http://mail.python.org/mailman/listinfo/python-list