我正在尝试解析网络文档(基于表格设计),并且我有一个包含表格的 div。
<div id="component">
<table ...>
....
如果我尝试:
XmlXPathSelector(response).select("//*[@id='component']")
这个有效:
[<XmlXPathSelector xpath="//*[@id='component']" data=u'<div xmlns="http://www.w3.org/1999/xhtml'>]
但是如果我想列出包含的表:
XmlXPathSelector(response).select("//*[@id='component']/table")
这将返回一个空结果。我尝试使用其他选择器,例如 "//*[@id='component']/tr" 和 "//*[@id='component']/a" 但那些也不起作用。
任何想法可能是错误的?
请您参考如下方法:
:P 我解决了这个问题,我使用的是 XmlPathSelector 而不是 *HTML*PathSelector
