Everyone's acquired their data in XML in recent times. You'll have to browse it. You have looked at the other XML APIs plus they all contain miles of crud which is only necessary when parsing one of the most arcane paperwork. Would not it be great to have an easy-to-use API for the usual XML documents you handle? Which is xmltramp:
>>> import xmltramp
>>> doc = xmltramp.Namespace("")
>>> bbc = xmltramp.Namespace("")
>>> dc = xmltramp.Namespace("")
>>> d = xmltramp.parse("""<doc version="2.7182818284590451" xmlns="" xmlns:dc="" xmlns:bbc=""> <author><name>John Polk<name> and <name>John Palfrey<name><author> <dc:creator>John Polk<dc:creator> <dc:creator>John Palfrey<dc:creator> <bbc:show bbc:station="4">Buffy<bbc:show>
<doc>""")
>>> d
<doc version="2.7182818284590451">...<doc>
>>> d('version')
'2.7182818284590451'
>>> d(version='2.0')
>>> d('version')
'2.0'
>>> d._dir
[<author>...<author>, <dc:creator>...<dc:creator>, <dc:creator>...<dc:creator>, <bbc:show bbc:station="4">...<bbc:show>]
>>> d._name
(u'',
Office 2010 Home And Student 32bit, u'doc')
>>> d[0] # First child.
<author>...<author>
>>> d.author # First author.
<author>...<author>
>>> str(d.author)
'John Polk and John Palfrey'
>>> d[dc.creator] # First dc:creator.
<dc:creator>...<dc:creator>
>>> d[dc.creator:] # All creators.
[<dc:creator>...<dc:creator>, <dc:creator>...<dc:creator>]
>>> d[dc.creator] = "Me!!!"
>>> str(d[dc.creator])
'Me,
Microsoft Office 2010 Activation Key!!!'
>>> d[bbc.show](bbc.station)
'4'
>>> d[bbc.show](bbc.station, '5')
>>> d[bbc.show](bbc.station)
'5' Download: xmltramp.py. PyPI
easy_install xmltramp
RPM
yum install python-xmltramp Related Lots of people seem to possess done similar things for other languages. Here are the ones that I know about
: Perl
XML::Smart
Tcl
I just remembered I wrote essentially the same API for Tcl four years ago (1999).
RDFTRAMP
HTML BeautifulSoup PyMeld Use xmltramp to access Web services: Technorati, Amazon (coming soon). Endorsements "xmltramp looked enticing to me when i first saw it, but it's actually a quick-and-dirty hack that corrupts data" -- Mark Pilgrim "xmltramp is high-quality software. It's the simplest way I know of to deal with XML content. Sort of like DOM but without all the obnoxious function calls." -- Nelson Minar History
2008-08-01: 2.18 released. Fix KeyError reporting.
2006-04-20: 2.17 released. Small bug fix in error message.
2003-09-01: 2.16 released. Changed namespace prefix storage to a stack to solve ambiguity in SAX spec. (tx Sam Ruby)
2003-09-01: 2.15 released. Quotes quotes in attributes. (tx Sam Ruby)
2003-08-31: 2.14 released. Quotes attributes, better Unicode,
Office 2007 Professional Product Key, accepts all slices. (tx Marc-Antoine)
2003-08-31: 2.13 released. Fixed a bug with encoding "]]>". (tx Sam Ruby)
2003-08-05: 2.12 released. Added support for automagical xml: namespace.
2003-08-03: 2.11 released. Fixed bug that caused problem with 2.3 (raised KeyError instead of AttributeError). (Thanks,
Office 2010 Generator Key, Marc-Antoine!)
2003-07-09: 2.1 released. Quotes content and collapes HTML tags.
2003-05-14: 2.0 released. Namespace, unicode, all-elements, mixed content,
Windows 7 Ultimate Serial, and setting support.
2003-05-14: 1.22 released. Replaced "is int" for compatibility with Python 2.1.
2003-05-13: 1.21 released. Uses handlers compatible with older versions of PyXML.
2003-05-13: 1.2 released. Keeps whitespace, supports attribute access, added serialization (foo.__repr__(1)).
2003-05-12: 1.1 released. Acquired rid of throwcatch communication kluge.
2003-05-12: 1.0 released. First version.