anyconfig/backend/xml.py
def elem_to_container(elem, container=dict, **options):
    """
    Convert XML ElementTree Element to a collection of container objects.

    Elements are transformed to a node under special tagged nodes, attrs, text
    and children, to store the type of these elements basically, however, in
    some special cases like the followings, these nodes are attached to the
    parent node directly for later convenience.

    - There is only text element
    - There are only children elements each has unique keys among all

    :param elem: ET Element object or None
    :param container: callble to make a container object
    :param options: Keyword options

        - nspaces: A namespaces dict, {uri: prefix} or None
        - attrs, text, children: Tags for special nodes to keep XML info
        - merge_attrs: Merge attributes and mix with children nodes, and the
          information of attributes are lost after its transformation.
    """
    dic = container()
    if elem is None:
        return dic

    elem.tag = _tweak_ns(elem.tag, **options)  # {ns}tag -> ns_prefix:tag
    subdic = dic[elem.tag] = container()
    options["container"] = container

    if elem.text:
        _process_elem_text(elem, dic, subdic, **options)

    if elem.attrib:
        _process_elem_attrs(elem, dic, subdic, **options)

    if len(elem):
        _process_children_elems(elem, dic, subdic, **options)
    elif not elem.text and not elem.attrib:  # ex. <tag/>.
        dic[elem.tag] = None

    return dic

    Convert XML ElementTree Element to a collection of container objects.

    Elements are transformed to a node under special tagged nodes, attrs, text
    and children, to store the type of these elements basically, however, in
    some special cases like the followings, these nodes are attached to the
    parent node directly for later convenience.

    - There is only text element
    - There are only children elements each has unique keys among all

    :param elem: ET Element object or None
    :param container: callble to make a container object
    :param options: Keyword options

        - nspaces: A namespaces dict, {uri: prefix} or None
        - attrs, text, children: Tags for special nodes to keep XML info
        - merge_attrs: Merge attributes and mix with children nodes, and the
          information of attributes are lost after its transformation.
    
Convert XML ElementTree Element to a collection of container objects.
Elements are transformed to a node under special tagged nodes, attrs, text
and children, to store the type of these elements basically, however, in
some special cases like the followings, these nodes are attached to the
parent node directly for later convenience.

There is only text element
There are only children elements each has unique keys among all
Convert XML ElementTree Element to a collection of container objects . Elements are transformed to a node under special tagged nodes attrs text and children to store the type of these elements basically however in some special cases like the followings these nodes are attached to the parent node directly for later convenience . There is only text element There are only children elements each has unique keys among all
def elem_to_container(elem, container=dict, **options):
    dic = container()
    if elem is None:
        return dic
    elem.tag = _tweak_ns(elem.tag, **options)  
    subdic = dic[elem.tag] = container()
    options["container"] = container
    if elem.text:
        _process_elem_text(elem, dic, subdic, **options)
    if elem.attrib:
        _process_elem_attrs(elem, dic, subdic, **options)
    if len(elem):
        _process_children_elems(elem, dic, subdic, **options)
    elif not elem.text and not elem.attrib:  
        dic[elem.tag] = None
    return dic
def elem_to_container ( elem , container = dict , ** options ) : dic = container ( ) if elem is None : return dic elem . tag = _tweak_ns ( elem . tag , ** options ) subdic = dic [ elem . tag ] = container ( ) options [ "container" ] = container if elem . text : _process_elem_text ( elem , dic , subdic , ** options ) if elem . attrib : _process_elem_attrs ( elem , dic , subdic , ** options ) if len ( elem ) : _process_children_elems ( elem , dic , subdic , ** options ) elif not elem . text and not elem . attrib : dic [ elem . tag ] = None return dic
Convert XML ElementTree Element to a collection of container objects.
Convert XML ElementTree Element to a collection of container objects .
"""
    Convert XML ElementTree Element to a collection of container objects.

    Elements are transformed to a node under special tagged nodes, attrs, text
    and children, to store the type of these elements basically, however, in
    some special cases like the followings, these nodes are attached to the
    parent node directly for later convenience.

    - There is only text element
    - There are only children elements each has unique keys among all

    :param elem: ET Element object or None
    :param container: callble to make a container object
    :param options: Keyword options

        - nspaces: A namespaces dict, {uri: prefix} or None
        - attrs, text, children: Tags for special nodes to keep XML info
        - merge_attrs: Merge attributes and mix with children nodes, and the
          information of attributes are lost after its transformation.
    """ # {ns}tag -> ns_prefix:tag # ex. <tag/>.
elem
ET Element object or None
ET Element object or None
container
callble to make a container object
callble to make a container object
options
Keyword options
nspaces: A namespaces dict, {uri: prefix} or None
attrs, text, children: Tags for special nodes to keep XML info
merge_attrs: Merge attributes and mix with children nodes, and the
information of attributes are lost after its transformation.
Keyword options nspaces : A namespaces dict { uri : prefix } or None attrs text children : Tags for special nodes to keep XML info merge_attrs : Merge attributes and mix with children nodes and the information of attributes are lost after its transformation .