S
Steve R. Hastings
xe.py is a Python module to make it very easy to work with XML. I have
attempted to make xe classes very Pythonic and intuitive. xe is intended
for working with structured XML, such as syndication feed files, but I
have added some support for unstructured XML as well.
Example:
<bird type="Norwegian Blue">just resting</bird>
<cheese>a bit runny</cheese>
</examples>
PyFeed is a Python module package set with modules for working with
syndication feeds. These modules use the xe classes. PyFeed currently
includes modules for working with Atom feeds, RSS 2.0 feeds, OPML 1.0
files, and OPML files.
Example:
File "<stdin>", line 1, in ?
File "/usr/local/lib/python/xe.py", line 1327, in __setattr__
o.direct(value)
File "/usr/local/lib/python/xe.py", line 1148, in direct
raise ValueError, "value must be a valid timestamp string"
ValueError: value must be a valid timestamp string1136102483.0
If there is any interest in these modules, I'll probably put them on
Sourceforge.net and on the Cheese Shop someday. For now, they live on my
personal web space:
http://www.blarg.net/~steveha/xe.html
http://www.blarg.net/~steveha/pyfeed.html
I look forward to any feedback.
attempted to make xe classes very Pythonic and intuitive. xe is intended
for working with structured XML, such as syndication feed files, but I
have added some support for unstructured XML as well.
Example:
<examples>import xe
bird = xe.TextElement("bird")
bird.attrs["type"] = "Norwegian Blue"
bird.text = "just resting"
print birdcheese = xe.TextElement("cheese")
cheese.text = "a bit runny"
examples = xe.NestElement("examples")
examples.bird = bird
examples.cheese = cheese
print examples
<bird type="Norwegian Blue">just resting</bird>
<cheese>a bit runny</cheese>
</examples>
PyFeed is a Python module package set with modules for working with
syndication feeds. These modules use the xe classes. PyFeed currently
includes modules for working with Atom feeds, RSS 2.0 feeds, OPML 1.0
files, and OPML files.
Example:
Traceback (most recent call last):import feed.rss
channel = feed.rss.Channel()
lst_errors = []
channel.import_xml("http://www.planetpython.org/rss20.xml", lst_errors)print len(lst_errors) or "No errors!" No errors!
print channel.titleprint len(channel.items) 45
print channel.items[0].title.text Mike Fletcher: Minor TwistedSNMP release is up
item = channel.items[0]
print item.pub_date.text Thu, 23 Mar 2006 15:45:31 -0800
# note that the date printed with "-0800", my time zone ....
item.pub_date.update()print item.pub_dateitem.pub_date = "not a valid timestamp"
File "<stdin>", line 1, in ?
File "/usr/local/lib/python/xe.py", line 1327, in __setattr__
o.direct(value)
File "/usr/local/lib/python/xe.py", line 1148, in direct
raise ValueError, "value must be a valid timestamp string"
ValueError: value must be a valid timestamp string1136102483.0
If there is any interest in these modules, I'll probably put them on
Sourceforge.net and on the Cheese Shop someday. For now, they live on my
personal web space:
http://www.blarg.net/~steveha/xe.html
http://www.blarg.net/~steveha/pyfeed.html
I look forward to any feedback.