I am just starting with python. I have a problem where I want to take a document that is in xml and take the items and enter them into a mysql database. The database part I know, I just need some hints on where to look to be able to parse something like this. <dict> <key>_name</key> <string>VLC</string> <key>info</key> <string>VLC media player 0.7.2, Copyright (c) 1996-2004 VideoLAN.</string> <key>lastModified</key> <date>2004-05-21T15:04:12Z</date> <key>path</key> <string>/Applications/VLC.app</string> <key>version</key> <string>0.7.2</string> </dict> <dict> <key>_name</key> <string>WeatherPop</string> <key>lastModified</key> <date>2003-06-19T05:35:22Z</date> <key>path</key> <string>/Applications/WeatherPop.app</string> <key>version</key> <string>1.8.1</string> </dict> etc.etc.etc. I want to be able to get the values for name and version for each application. I don't need any other information. Can someone give me some ideas on where to look for more information on doing something like this? Mike
Mike Tuller wrote:
I am just starting with python.
Oops, wrong list. This list is for development OF Python, not WITH. That said, your data below looks a lot like plist. If it is, have a look at: http://cvs.sourceforge.net/viewcvs.py/*checkout*/python/python/dist/src/ Lib/plat-mac/plistlib.py (unwrap url). You need Python 2.3 to use this module. Just
Mike Tuller wrote:
I am just starting with python. I have a problem where I want to take a document that is in xml [...]
You may get any number of helpful answers (zero is a number too, heh) if you post this to the Python XML SIG list. There are various ways to go about it, both with Python's built-in XML parsing capabilities, and with external packages. See http://mail.python.org/mailman/listinfo/xml-sig/
participants (3)
-
Just van Rossum -
Mike Brown -
Mike Tuller