Re: [Tutor] Python XML for newbie

2012-07-02 Thread Peter Otten
Sean Carolan wrote: Thank you, this is helpful. Minidom is confusing, even the documentation confirms this: The name of the functions are perhaps misleading But I'd start with the etree tutorial (of which there are many variations on the web): Ok, so I read through these tutorials

Re: [Tutor] Python XML for newbie

2012-07-02 Thread Stefan Behnel
Peter Otten, 02.07.2012 09:57: Sean Carolan wrote: Thank you, this is helpful. Minidom is confusing, even the documentation confirms this: The name of the functions are perhaps misleading Yes, I personally think that (Mini)DOM should be locked away from beginners as far as possible.

Re: [Tutor] Python XML for newbie

2012-07-02 Thread Sean Carolan
Yes, I personally think that (Mini)DOM should be locked away from beginners as far as possible. Ok, I'm glad to hear that. I'll continue to work with ElementTree and lxml and see where it takes me. ___ Tutor maillist - Tutor@python.org To

[Tutor] Python XML for newbie

2012-07-01 Thread Sean Carolan
I'm trying to parse some XML data (Book titles, ISBN numbers and descriptions) with Python. Is there a *simple* way to import an XML file into a dictionary, list, or other usable data structure? I've poked around with minidom, elementtree, and untangle but am not really understanding how they

Re: [Tutor] Python XML for newbie

2012-07-01 Thread Alan Gauld
On 01/07/12 21:49, Sean Carolan wrote: ... Is there a *simple* way to import an XML file into a dictionary, list, or other usable data structure? The simplest way using the standard library tools is (IMHO) elementtree. minidom is a complex beast by comparison, especially if you are not

Re: [Tutor] Python XML for newbie

2012-07-01 Thread Sean Carolan
The simplest way using the standard library tools is (IMHO) elementtree. minidom is a complex beast by comparison, especially if you are not intimately familiar with your XML structure. Thank you, this is helpful. Minidom is confusing, even the documentation confirms this: The name of the

Re: [Tutor] Python XML for newbie

2012-07-01 Thread Sean Carolan
Thank you, this is helpful. Minidom is confusing, even the documentation confirms this: The name of the functions are perhaps misleading But I'd start with the etree tutorial (of which there are many variations on the web): Ok, so I read through these tutorials and am at least able to

Re: [Tutor] Python XML for newbie

2012-07-01 Thread David Kidd
On Mon, Jul 2, 2012 at 12:31 PM, Sean Carolan scaro...@gmail.com wrote: How do you say, If the field is 11, then print the next value? The raw XML looks like this: datum index1/index field11/field value9780470286975/value /datum Instead of iterating over the whole tree, grab all the