首先,我将链接我相当大的 xml 文档的开头,然后链接我用来读取 xml 文档的代码;编译bu会引发以下异常。“根级别的数据无效。第 1 行,位置 1”
<icalendar xmlns="urn:ietf:params:xml:ns:icalendar-2.0">
<!--
created utilizing kigkonsult.se iCalcreator 2.16.12 iCal2XMl (rfc6321)
-->
<vcalendar>
<properties>
<prodid>
<text>
-//opendata.unm.edu//NONSGML kigkonsult.se iCalcreator 2.16.12//
</text>
</prodid>
<version>
<text>2.0</text>
</version>
<method>
<text>PUBLISH</text>
</method>
</properties>
<components>
<vevent>
<properties>
<uid>
<text>caf72d80-edec-4175-96d8-802a68fa186f</text>
</uid>
<dtstamp>
<date-time>2013-10-17T20:45:00Z</date-time>
</dtstamp>
<summary>
<text>UFO Speaker Stanton Friedman</text>
</summary>
<description>
我的 Visual Basic 2010 Express for Phone 代码:
Public Sub LoadData()
Try
Dim filePathUnm As String = "http://datastore.unm.edu/events/events.xml"
Dim rs As XmlReaderSettings = New XmlReaderSettings()
rs.DtdProcessing = DtdProcessing.Parse
rs.IgnoreWhitespace = True
Dim unmEventXml As XmlReader = XmlReader.Create(New StringReader(filePathUnm), rs)
While unmEventXml.Read()
Select Case unmEventXml.NodeType
End Select
End While
Me.IsDataLoaded = True
Catch ex As XmlException
MessageBox.Show(ex.Message)
End Try
End Sub
非常感谢!此 xml 代码来自公共存储库,因此我需要能够阅读它。这也位于存储库的顶部。“此 XML 文件似乎没有与之关联的任何样式信息。文档树如下所示。” 这是存储库的链接:http: //datastore.unm.edu/events/events.xml