,我有以下的Django的代碼和它返回約tagName
屬性的錯誤:Element.tagName爲Python不工作
def _parse_google_checkout_response(response_xml):
redirect_url=''
xml_doc=minidom.parseString(response_xml)
root = xml_doc.documentElement
node=root.childNodes[1]
if node.tagName == 'redirect-url':
redirect_url=node.firstChild.data
if node.tagName == 'error-message':
raise RuntimeError(node.firstChild.data)
return redirect_url
這裏的錯誤響應:
Exception Type: AttributeError
Exception Value:
Text instance has no attribute 'tagName'
任何人都有一個線索到這裏發生了什麼?