def xsd2dict(xsd, namespace='xsd'):
    """ Function that creates a dictionary from a xml schema with the type of element """
    types = ['xsd:integer', 'xsd:decimal', 'xsd:double', 'xsd:float',
        'xsd:duration', 'xsd:date', 'xsd:time', 'xsd:dateTime',
        'xsd:string', 'xsd:boolean']
    dct = {}
    element = '%s:element' % namespace
    elems = xsd.getElementsByTagName(element)
    for e in elems:
        val = 'complexType'
        typ = str(e.getAttribute('type'))
        lst = e.hasAttribute('maxOccurs')
        if types.count(typ) > 0:
            val = 'element'
        dct[str(e.getAttribute('name'))] = val, typ, lst
    return dct
