Python 使用pykml解析kml时出现Lxml错误

Python 使用pykml解析kml时出现Lxml错误,python,parsing,lxml,kml,pykml,Python,Parsing,Lxml,Kml,Pykml,我正在尝试使用pykml解析包含多个placemarks的kml文件。我想编辑kml描述中的HTML代码,主要用于Google Earth中地理数据的可视化目的。我研究了很多方法: 但是,我总是得到如下所示的lxml错误:( 我已经安装了pykml和lxml 3.6.0,我目前正在使用我的Python 2.7.10。kml文件包含行。(kml链接:) 我还使用了ArcGIS 10.2中的Python 2.7 我是处理kml文件的新手。有人能告诉我我做错了什么吗?或者有没有更简单的方法

我正在尝试使用pykml解析包含多个placemarks的kml文件。我想编辑kml描述中的HTML代码,主要用于Google Earth中地理数据的可视化目的。我研究了很多方法:

但是,我总是得到如下所示的lxml错误:(

我已经安装了pykml和lxml 3.6.0,我目前正在使用我的Python 2.7.10。kml文件包含行。(kml链接:) 我还使用了ArcGIS 10.2中的Python 2.7


我是处理kml文件的新手。有人能告诉我我做错了什么吗?或者有没有更简单的方法来编辑kml文件的描述?非常感谢。:)

xml有一些问题,如果要删除错误,请添加
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance“
到第二行:

<kml  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
这给了你:

[<Element {http://www.opengis.net/kml/2.2}description at 0x7f612d0885f0>, <Element {http://www.opengis.net/kml/2.2}description at 0x7f612d088cb0>, <Element {http://www.opengis.net/kml/2.2}description at 0x7f612d088d40>, <Element {http://www.opengis.net/kml/2.2}description at 0x7f612d088d88>, <Element {http://www.opengis.net/kml/2.2}description at 0x7f612d088dd0>, <Element {http://www.opengis.net/kml/2.2}description at 0x7f612d088e18>]
[<Element description at 0x7f1c757fad08>, <Element description at 0x7f1c757fad60>, <Element description at 0x7f1c757fadb8>, <Element description at 0x7f1c757fae10>, <Element description at 0x7f1c757fae68>, <Element description at 0x7f1c757faec0>]
这给了你:

[<Element {http://www.opengis.net/kml/2.2}description at 0x7f612d0885f0>, <Element {http://www.opengis.net/kml/2.2}description at 0x7f612d088cb0>, <Element {http://www.opengis.net/kml/2.2}description at 0x7f612d088d40>, <Element {http://www.opengis.net/kml/2.2}description at 0x7f612d088d88>, <Element {http://www.opengis.net/kml/2.2}description at 0x7f612d088dd0>, <Element {http://www.opengis.net/kml/2.2}description at 0x7f612d088e18>]
[<Element description at 0x7f1c757fad08>, <Element description at 0x7f1c757fad60>, <Element description at 0x7f1c757fadb8>, <Element description at 0x7f1c757fae10>, <Element description at 0x7f1c757fae68>, <Element description at 0x7f1c757faec0>]
[,,]

xml有一些问题,如果要删除错误,请添加
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance“
到第二行:

<kml  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
这给了你:

[<Element {http://www.opengis.net/kml/2.2}description at 0x7f612d0885f0>, <Element {http://www.opengis.net/kml/2.2}description at 0x7f612d088cb0>, <Element {http://www.opengis.net/kml/2.2}description at 0x7f612d088d40>, <Element {http://www.opengis.net/kml/2.2}description at 0x7f612d088d88>, <Element {http://www.opengis.net/kml/2.2}description at 0x7f612d088dd0>, <Element {http://www.opengis.net/kml/2.2}description at 0x7f612d088e18>]
[<Element description at 0x7f1c757fad08>, <Element description at 0x7f1c757fad60>, <Element description at 0x7f1c757fadb8>, <Element description at 0x7f1c757fae10>, <Element description at 0x7f1c757fae68>, <Element description at 0x7f1c757faec0>]
这给了你:

[<Element {http://www.opengis.net/kml/2.2}description at 0x7f612d0885f0>, <Element {http://www.opengis.net/kml/2.2}description at 0x7f612d088cb0>, <Element {http://www.opengis.net/kml/2.2}description at 0x7f612d088d40>, <Element {http://www.opengis.net/kml/2.2}description at 0x7f612d088d88>, <Element {http://www.opengis.net/kml/2.2}description at 0x7f612d088dd0>, <Element {http://www.opengis.net/kml/2.2}description at 0x7f612d088e18>]
[<Element description at 0x7f1c757fad08>, <Element description at 0x7f1c757fad60>, <Element description at 0x7f1c757fadb8>, <Element description at 0x7f1c757fae10>, <Element description at 0x7f1c757fae68>, <Element description at 0x7f1c757faec0>]
[,,]

你能把文件寄到这里吗?它是否包括
?是的,它有一个xml头。我在我的帖子中包含了kml链接:)(我使用的kml Im是通过Arcgis中的kml图层生成的)我现在使用lxml.html来解析它(顺便说一句=))你能在这里发布文档吗?它是否包括
?是的,它有一个xml头。我在我的帖子中加入了kml链接:)(我使用的kml是通过Arcgis中的kml层生成的)我现在使用lxml.html来解析它(顺便说一句=))哦,哇!现在开始工作了。谢谢@PadraicCunningham!我改为使用lxml.html.:)哦,哇!现在开始工作了。谢谢@PadraicCunningham!我改为使用lxml.html.:)