diff options
-rw-r--r-- | src/lxml/builder.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/lxml/builder.py b/src/lxml/builder.py index 460d2286..c5c25b74 100644 --- a/src/lxml/builder.py +++ b/src/lxml/builder.py @@ -140,6 +140,17 @@ class ElementMaker(object): <p>And finally, here is an embedded XHTML fragment.</p> </body> </html> + + For namespace support, you can pass a namespace map (``nsmap``) + and/or a specific target ``namespace`` to the ElementMaker class:: + + >>> E = ElementMaker(namespace="http://my.ns/") + >>> print(ET.tostring( E.test )) + <test xmlns="http://my.ns/"/> + + >>> E = ElementMaker(namespace="http://my.ns/", nsmap={'p':'http://my.ns/'}) + >>> print(ET.tostring( E.test )) + <p:test xmlns:p="http://my.ns/"/> """ def __init__(self, typemap=None, |