Mercurial > genshi > genshi-test
diff genshi/builder.py @ 410:3460b04daeac
Improve the handling of namespaces in serialization.
author | cmlenz |
---|---|
date | Mon, 26 Feb 2007 18:26:59 +0000 |
parents | 49a3bae5a8bb |
children | 5b248708bbed |
line wrap: on
line diff
--- a/genshi/builder.py +++ b/genshi/builder.py @@ -163,7 +163,7 @@ >>> from genshi.core import Namespace >>> xhtml = Namespace('http://www.w3.org/1999/xhtml') >>> print Element(xhtml.html, lang='en') - <html lang="en" xmlns="http://www.w3.org/1999/xhtml"/> + <html xmlns="http://www.w3.org/1999/xhtml" lang="en"/> """ __slots__ = ['tag', 'attrib'] @@ -213,14 +213,14 @@ >>> factory = ElementFactory('http://www.w3.org/1999/xhtml') >>> print factory.html(lang="en") - <html lang="en" xmlns="http://www.w3.org/1999/xhtml"/> + <html xmlns="http://www.w3.org/1999/xhtml" lang="en"/> The namespace for a specific element can be altered on an existing factory by specifying the new namespace using item access: >>> factory = ElementFactory() >>> print factory.html(factory['http://www.w3.org/2000/svg'].g(id=3)) - <html><g id="3" xmlns="http://www.w3.org/2000/svg"/></html> + <html><g xmlns="http://www.w3.org/2000/svg" id="3"/></html> Usually, the `ElementFactory` class is not be used directly. Rather, the `tag` instance should be used to create elements.