Google app engine TypeError:无法读取属性";t车身“;从未定义
我正在尝试解析google apps脚本中的html,html中元素的xPath是:Google app engine TypeError:无法读取属性";t车身“;从未定义,google-app-engine,xml-parsing,google-apps-script,html-parsing,Google App Engine,Xml Parsing,Google Apps Script,Html Parsing,我正在尝试解析google apps脚本中的html,html中元素的xPath是: /html/body/table/tbody/tr/td/table/tbody/tr[1]/td/table/tbody/tr[3]/td/table/tbody/tr/td/table/tbody/tr/td[2]/table/tbody/tr[2]/td/table/tbody/tr[2]/td[2]/table/tbody/tr[2]/td[1]/table[2]/tbody/tr[3]/td[8]
/html/body/table/tbody/tr/td/table/tbody/tr[1]/td/table/tbody/tr[3]/td/table/tbody/tr/td/table/tbody/tr/td[2]/table/tbody/tr[2]/td/table/tbody/tr[2]/td[2]/table/tbody/tr[2]/td[1]/table[2]/tbody/tr[3]/td[8]
如何在脚本中访问它?我尝试了以下方法:
var doc = Xml.parse(responseText, true);
var number = doc.html.body.table.tbody.tr.td
.table.tbody.tr[1].td.table.tbody
.tr[3].td.table.tbody.tr.td.table
.tbody.tr.td[2].table.tbody.tr[2]
.td.table.tbody.tr[2].td[2].table
.tbody.tr[2].td[1].table[2].tbody
.tr[3].td[1];
请帮助。它看起来像是一个元素的层次结构,您将其视为一个单链。 请发布xml字符串
responseText
,而不是这个“xPath”,以便您和我们可以更清楚地看到它。还请在xml上指定您试图获取的元素
当你更新你的问题时,我会更新我的答案。xPath本身是错误的,tbody是由firefox添加的。因此,请检查IE中的路径。responseText是一个非常长的HTML代码,如何将其附加到此处?您可以在pastebin.com上执行此操作,也可以仅粘贴相关部分。这个xml是公共可访问的吗?我的意思是,我可以自己取吗?xPath本身是错误的,tbody是由firefox添加的。谢谢大家。