我写了一个小函数,它使用 ElementTree 来解析 xml 文件,但它抛出以下错误“xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 1, column 0”。请在下面找到代码
tree = ElementTree.parse(urllib2.urlopen('http://api.ean.com/ean-services/rs/hotel/v3/list?type=xml&apiKey=czztdaxrhfbusyp685ut6g6v&cid=8123&locale=en_US&city=Dallas%20&stateProvinceCode=TX&countryCode=US&minorRev=12'))
rootElem = tree.getroot()
hotel_list = rootElem.findall("HotelList")