I must be missing something. I'm attempting to set up a google product feed, but am having a hard time registering the namespace.
Example:
Directions here: http://ift.tt/Vc7C3K
Trying to insert:
<rss version="2.0"
xmlns:g="http://ift.tt/15FVsV8">
This is the code:
from xml.etree import ElementTree
from xml.etree.ElementTree import Element, SubElement, Comment, tostring
tree = ElementTree
tree.register_namespace('xmlns:g', 'http://ift.tt/15FVsV8')
top = tree.Element('top')
#... more code and stuff
After code is run, everything turns out fine, but we're missing the xmlns=
I find it easier to create XML docs in php, but I figured I'd give this a try. Where am I going wrong?
On that note, perhaps there is a more appropriate way to do this in python, not using etree?
No comments:
Post a Comment