lck.common 0.4.4 documentation

This Page

lck.xml

lck.xml

Various XML-related utilities.

decode_entities(string[, encoding]) → string_with_decoded_entities

Decodes XML entities from the given string. Supports both Unicode and bytestring arguments.

Note: when using a bytestring string argument, a bytestring will be returned. In that case however, encoding has to be specified, otherwise an UnicodeDecodeError will be raised. This is because we have to support the &#xxxx; entity which enables people to use any Unicode codepoint.

etree_to_dict(element, [namespace]) -> ("tag_name", dict_with_children)

element must be a valid ElementTree element. namespace is optional, must be given in Clark notation, e.g. “{ns_uri}”.