Re: ElementTree and namespaces in the header only

2008-01-16 Thread Peter Bengtsson
On Jan 15, 5:22 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Peter Bengtsson wrote: > > root = Element('feed', xmlns='http://www.w3.org/2005/Atom') > > root.set('xmlns:se', NS_URL) > > entry = SubElement(root, 'entry') > > SubElement(root, 'title').text = 'Title' > > SubElement(entry, SEN('catego

Re: ElementTree and namespaces in the header only

2008-01-15 Thread Torsten Bronger
Hallöchen! Fredrik Lundh writes: > Peter Bengtsson wrote: > >> root = Element('feed', xmlns='http://www.w3.org/2005/Atom') >> root.set('xmlns:se', NS_URL) >> entry = SubElement(root, 'entry') >> SubElement(root, 'title').text = 'Title' >> SubElement(entry, SEN('category')).text = 'Category' > >>

Re: ElementTree and namespaces in the header only

2008-01-15 Thread Fredrik Lundh
Peter Bengtsson wrote: > root = Element('feed', xmlns='http://www.w3.org/2005/Atom') > root.set('xmlns:se', NS_URL) > entry = SubElement(root, 'entry') > SubElement(root, 'title').text = 'Title' > SubElement(entry, SEN('category')).text = 'Category' > But surely the xmlns:se attribute on the tag

ElementTree and namespaces in the header only

2008-01-15 Thread Peter Bengtsson
Here's my code (simplified): NS_URL = 'http://www.snapexpense.com/atom_ns#' ElementTree._namespace_map[NS_URL] = 'se' def SEN(tag): return "{%s}%s" % (NS_URL, tag) root = Element('feed', xmlns='http://www.w3.org/2005/Atom') root.set('xmlns:se', NS_URL) entry = SubElement(root, 'entry') SubEle