def xml_to_nodes()

in mns/mns_xml_handler.py [0:0]


    def xml_to_nodes(tag_name, xml_data):
        if xml_data == "":
            raise MNSClientNetworkException("RespDataDamaged", "Xml data is \"\"!")

        try:
            if (sys.version_info.major < 3) and (not isinstance(xml_data, str)):
                xml_data = xml_data.encode('utf-8')
            dom = xml.dom.minidom.parseString(xml_data)
        except Exception:
            raise MNSClientNetworkException("RespDataDamaged", xml_data)

        nodelist = dom.getElementsByTagName(tag_name)
        if not nodelist:
            raise MNSClientNetworkException("RespDataDamaged", "No element with tag name '%s'.\nData:%s" % (tag_name, xml_data))

        return nodelist[0].childNodes