我正在尝试从 KML 文件中的地标中提取多边形。到现在为止还挺好:
Imports <xmlns:g='http://earth.google.com/kml/2.0'>
Imports System.Xml.Linq
Partial Class Test_ImportPolygons
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim Kml As XDocument = XDocument.Load(Server.MapPath("../kmlimport/ga.kml"))
For Each Placemark As XElement In Kml.<g:Document>.<g:Folder>.<g:Placemark>
Dim Name As String = Placemark.<g:name>.Value
...
Next
End Sub
End Class
我想将整个<polygon>...</polygon>
块捕获为字符串。我尝试过这样的事情(上面的 ... ):
Dim Polygon as String = Placemark.<g:Polygon>.InnerText
但据我所知,XElement 对象没有 InnerText 属性或任何等价物。如何获取定义 XElement 的原始 XML?