anyconfig/backend/xml.py
def root_to_container(root, container=dict, nspaces=None, **options):
    """
    Convert XML ElementTree Root Element to a collection of container objects.

    :param root: etree root object or None
    :param container: callble to make a container object
    :param nspaces: A namespaces dict, {uri: prefix} or None
    :param options: Keyword options,

        - tags: Dict of tags for special nodes to keep XML info, attributes,
          text and children nodes, e.g. {"attrs": "@attrs", "text": "#text"}
    """
    tree = container()
    if root is None:
        return tree

    if nspaces is not None:
        for uri, prefix in nspaces.items():
            root.attrib["xmlns:" + prefix if prefix else "xmlns"] = uri

    return elem_to_container(root, container=container, nspaces=nspaces,
                             **_complement_tag_options(options))

    Convert XML ElementTree Root Element to a collection of container objects.

    :param root: etree root object or None
    :param container: callble to make a container object
    :param nspaces: A namespaces dict, {uri: prefix} or None
    :param options: Keyword options,

        - tags: Dict of tags for special nodes to keep XML info, attributes,
          text and children nodes, e.g. {"attrs": "@attrs", "text": "#text"}
    
Convert XML ElementTree Root Element to a collection of container objects.
Convert XML ElementTree Root Element to a collection of container objects .
def root_to_container(root, container=dict, nspaces=None, **options):
    tree = container()
    if root is None:
        return tree
    if nspaces is not None:
        for uri, prefix in nspaces.items():
            root.attrib["xmlns:" + prefix if prefix else "xmlns"] = uri
    return elem_to_container(root, container=container, nspaces=nspaces,
                             **_complement_tag_options(options))
def root_to_container ( root , container = dict , nspaces = None , ** options ) : tree = container ( ) if root is None : return tree if nspaces is not None : for uri , prefix in nspaces . items ( ) : root . attrib [ "xmlns:" + prefix if prefix else "xmlns" ] = uri return elem_to_container ( root , container = container , nspaces = nspaces , ** _complement_tag_options ( options ) )
Convert XML ElementTree Root Element to a collection of container objects.
Convert XML ElementTree Root Element to a collection of container objects .
"""
    Convert XML ElementTree Root Element to a collection of container objects.

    :param root: etree root object or None
    :param container: callble to make a container object
    :param nspaces: A namespaces dict, {uri: prefix} or None
    :param options: Keyword options,

        - tags: Dict of tags for special nodes to keep XML info, attributes,
          text and children nodes, e.g. {"attrs": "@attrs", "text": "#text"}
    """
root
etree root object or None
etree root object or None
container
callble to make a container object
callble to make a container object
nspaces
A namespaces dict, {uri: prefix} or None
A namespaces dict { uri : prefix } or None
options
Keyword options,
tags: Dict of tags for special nodes to keep XML info, attributes,
text and children nodes, e.g.
Keyword options tags : Dict of tags for special nodes to keep XML info attributes text and children nodes e . g .