Using XML w/ Python...
uche.ogbuji at gmail.com
uche.ogbuji at gmail.com
Sun Dec 11 15:45:51 EST 2005
Jay:
"""
K, I have this XML doc, i dont know much about XML, but what i want
to do is take certain parts of the XML doc, such as </title> blah
</title> and take just that and put onto a text doc. Then same thing
doe the </body> part. Thats about it, i checked out some of the xml
modules but dont understand how to use them. Dont get parsing, so if
you could please explain working with XML and python to me.
"""
Someone already mentioned
http://www.oreillynet.com/pub/wlg/6225
I do want to update that Amara API. As of recent releases it's as
simple as
import amara
doc = amara.parse("foo.opml")
for url in doc.xpath("//@xmlUrl"):
print url.value
Besides the XPath option, Amara [1] provides Python API options for
unknown elements, such as
node.xml_child_elements
node.xml_attributes
This is all covered with plenty of examples in the manual [2]
[1] http://uche.ogbuji.net/tech/4suite/amara/
[2] http://uche.ogbuji.net/uche.ogbuji.net/tech/4suite/amara/manual-dev
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.net http://fourthought.com
http://copia.ogbuji.net http://4Suite.org
Articles: http://uche.ogbuji.net/tech/publications/
More information about the Python-list
mailing list