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: https://support.google.com/merchants/answer/160589
Trying to insert:
<rss version="2.0"
xmlns:g="http://base.google.com/ns/1.0">
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://base.google.com/ns/1.0')
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?