9f992b812ccec2ccd1f505057565270e8f1145d5
[cas.git] / provider / cas_provider / etree.py
1 # lxml http://codespeak.net/lxml/
2 from lxml import etree
3
4 # Define register_namespace function and ElementRoot for proper serialization
5 NSMAP = {}
6
7
8 def register_namespace(prefix, uri):
9     NSMAP[prefix] = uri
10
11
12 def ElementRoot(*args, **kwargs):
13     kwargs['nsmap'] = NSMAP
14     return etree.Element(*args, **kwargs)
15
16 __all__ = ('etree', 'register_namespace', 'ElementRoot')