# Path: coherence/extern/et.py
# def new_encode_entity(text, pattern=utf8_escape):
#     def escape_entities(m, map=elementtree.ElementTree._escape_map):
#     def XMLParser(encoding='utf-8'):
# def namespace_map_update(namespaces):
# def indent(elem, level=0):
# def parse_xml(data, encoding="utf-8", dump_invalid_data=False):
# def qname(tag, ns=None):
# def textElement(parent, tag, namespace, text):
# def textElementIfNotNone(parent, tag, namespace, text):
# class ElementInterface(elementtree.ElementTree._ElementInterface): pass


from coherence.extern.et import ET, indent, textElement
    import sys
      as the value

    at the moment we parse the xml file and create dicts or lists out
    of the nodes, but maybe it is much easier to keep the xml structure
    as it is and simulate the dict/list access behavior on it?

    """

    def __init__(self, file):
        self.file = file
        dict.__init__(self)
        try:
            xml = ET.parse(file)
        except (SyntaxError, IOError):
            raise
        except Exception, msg:
            raise SyntaxError(msg)

        xmlroot = xml.getroot()
        self.name = xmlroot.tag
        self.from_element(xmlroot)

    def save(self, file=None):
        if file == None:
            file = self.file
        e = ET.Element(self.name)
        for key, value in self.items():
            if isinstance(value, (dict, list)):
                e.append(value.to_element())
            else:

# Path: coherence/extern/et.py
# def new_encode_entity(text, pattern=utf8_escape):
#     def escape_entities(m, map=elementtree.ElementTree._escape_map):
#     def XMLParser(encoding='utf-8'):
# def namespace_map_update(namespaces):
# def indent(elem, level=0):
# def parse_xml(data, encoding="utf-8", dump_invalid_data=False):
# def qname(tag, ns=None):
# def textElement(parent, tag, namespace, text):
# def textElementIfNotNone(parent, tag, namespace, text):
# class ElementInterface(elementtree.ElementTree._ElementInterface): pass


# Path: coherence/extern/config.py
from coherence.extern.et import ET, indent, textElement
    import sys

      as the value

    at the moment we parse the xml file and create dicts or lists out
    of the nodes, but maybe it is much easier to keep the xml structure
    as it is and simulate the dict/list access behavior on it?

    """

    def __init__(self, file):
        self.file = file
        dict.__init__(self)
        try:
            xml = ET.parse(file)
        except (SyntaxError, IOError):
            raise
        except Exception, msg:
            raise SyntaxError(msg)

        xmlroot = xml.getroot()
        self.name = xmlroot.tag
        self.from_element(xmlroot)

    def save(self, file=None):
        if file == None:
            file = self.file
        e = ET.Element(self.name)
        for key, value in self.items():
            if isinstance(value, (dict, list)):
                e.append(value.to_element())
            else:

                textElement(e, key, None, str(value))