Namespace Declarations With cElementTree

If you use cElementTree and try to create an XML file that uses some extra XML namespaces, you will encounter a wierd situation when the final file is written.

For example, I wanted to add the Creative Commons RSS module in a feed. What I expected to see in the XML file was the following:


What I got was the following:


This is totally correct, but how on earth could I get the namespace declaration and the CC element written as I wrote in the first example? After a lot of web searching I found a blog post that deals exactly with this problem.

Namespace Declarations With cElementTree by George Notaras is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Copyright © 2006 - Some Rights Reserved

George Notaras avatar

About George Notaras

George Notaras is the editor of the G-Loaded Journal, a technical blog about Free and Open-Source Software. George, among other things, is an enthusiast self-taught GNU/Linux system administrator. He has created this web site to share the IT knowledge and experience he has gained over the years with other people. George primarily uses CentOS and Fedora. He has also developed some open-source software projects in his spare time.