Model/lib/xml2dict.py
def xmltodict(element):
    """converts the XML-file to a dictionary"""
    def xmltodict_handler(parent_element,result={}):
        for element in parent_element:
            if len(element):
                obj = xmltodict_handler(element)
            else:
                obj = element.attrib
                for i, j in obj.items():
                    try:
                        obj[i]=float(j)
                    except:
                        pass
            if result.get(element.tag):
                if hasattr(result[element.tag], "append"):
                    result[element.tag].append(obj)
                else:
                    result[element.tag] = [result[element.tag], obj]
            else:
                result[element.tag] = obj
        return result

    result=element.attrib
    return xmltodict_handler(element,result)
converts the XML-file to a dictionary
converts the XML-file to a dictionary
converts the XML - file to a dictionary
def xmltodict(element):
    def xmltodict_handler(parent_element,result={}):
        for element in parent_element:
            if len(element):
                obj = xmltodict_handler(element)
            else:
                obj = element.attrib
                for i, j in obj.items():
                    try:
                        obj[i]=float(j)
                    except:
                        pass
            if result.get(element.tag):
                if hasattr(result[element.tag], "append"):
                    result[element.tag].append(obj)
                else:
                    result[element.tag] = [result[element.tag], obj]
            else:
                result[element.tag] = obj
        return result
    result=element.attrib
    return xmltodict_handler(element,result)
def xmltodict ( element ) : def xmltodict_handler ( parent_element , result = { } ) : for element in parent_element : if len ( element ) : obj = xmltodict_handler ( element ) else : obj = element . attrib for i , j in obj . items ( ) : try : obj [ i ] = float ( j ) except : pass if result . get ( element . tag ) : if hasattr ( result [ element . tag ] , "append" ) : result [ element . tag ] . append ( obj ) else : result [ element . tag ] = [ result [ element . tag ] , obj ] else : result [ element . tag ] = obj return result result = element . attrib return xmltodict_handler ( element , result )
converts the XML-file to a dictionary
converts the XML - file to a dictionary
"""converts the XML-file to a dictionary"""
element