我尝试在 python 中使用 xpath 进行查询,以便打印 kml 文件的不同部分。
问题是:当我进行查询时,我得到了非常奇怪的结果。
这是我的代码:
import libxml2
rss=libxml2.parseDoc(open('/home/julien/xpath/SUPPORT2.kml').read())
#print doc
node=rss.xpathEval('//Placemark')
print node
这是结果:
[<xmlNode (Placemark) object at 0xa3e2acc>, <xmlNode (Placemark) object at0xa3e2b6c>, <xmlNode (Placemark) object at 0xa3e2d4c>, <xmlNode (Placemark)
object at 0xa3e2dac>, <xmlNode (Placemark) object at 0xa3e2dec>, <xmlNode
Placemark) object at 0xa3e2dcc>, <xmlNode (Placemark) object at 0xa3e2d8c>,
<xmlNode (Placemark) object at 0xa3e2e0c>, <xmlNode (Placemark) object at
0xa3e2eac>, <xmlNode (Placemark) object at 0xa3e2fec>, <xmlNode (Placemark)
object at 0xa3e2f0c>, <xmlNode (Placemark) object at 0xa3e2f2c>, <xmlNode
(Placemark) object at 0xa3e2f4c>, <xmlNode (Placemark) object at 0xa3e2f6c>,
<xmlNode (Placemark) object at 0xa3e2f8c>]
什么可以解释这个结果?我可以在我的代码中添加什么来使我的查询工作?