I think I have one, thanks. Have a great day, Alex Email: mehgcap@xxxxxxxxx----- Original Message ----- From: "Ken Perry" <whistler@xxxxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx> Sent: Wednesday, January 20, 2010 20:41 Subject: RE: python and xml?
You can do this several ways you might want to look at the mini dom it willparse the xml into a parse tree and you can get the information that way.That or you can use the sax style parser but that takes a bit more work. It depends on what type of machine your running on for example I write code for small devices and if you use the dom or mini dom stuff it really is slow ifit's on a pc it is not slow it's pretty fast actually. There is also Xpatfor python and there are all kinds of third party python xml parsers so it'shard to say what you should use. Ken -----Original Message----- From: programmingblind-bounce@xxxxxxxxxxxxx [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Alex Hall Sent: Wednesday, January 20, 2010 10:40 AM To: Blind Programming List Subject: python and xml? Hi all, Is there an easy way to parse xml files in python? Say you have the file <products> <item> CD <price> $9.95 </price> </item> <item> DVD <price> $14.95 </price> </item> </products> I would like to be able to get as far into the structure as I want, then have everything below that be a list. For example: items=xmlFile["products"] print("item is "+items[0]+" and costs "+items[0]["price"])I know I am mixing two types of data structures, but you see what I mean, atleast I hope you do. Anyone have suggestions? I have not done a lot with xmlbefore, but I understand children, nodes, and so on. Have a great day, Alex Email: mehgcap@xxxxxxxxx __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind
__________View the list's information and change your settings at //www.freelists.org/list/programmingblind