我试图在此网址中读取rss文件: http://www.alarabiya.net/.mrss/ar/sport.xml
此文件以标头开头: 此XML文件似乎没有与之关联的任何样式信息。文档树如下所示。
可能是因为XML文件的版本是2.0。
当我执行下面的代码时出现此错误:
Expected DTD markup was not found. Line 1, position 3.
代码可以正常使用XML文件版本为1.0的其他URL。
Dim rssXmlDoc As New XmlDocument()
rssXmlDoc.Load(http://www.alarabiya.net/.mrss/ar/sport.xml)
Dim rssNodes As XmlNodeList = rssXmlDoc.SelectNodes("rss/channel/item")
Dim rssContent As New StringBuilder()
For Each rssNode As XmlNode In rssNodes
Dim rssSubNode As XmlNode
rssSubNode = rssNode.SelectSingleNode("link")
link = If(rssSubNode IsNot Nothing, rssSubNode.InnerText, "")
rssSubNode = rssNode.SelectSingleNode("title")
Dim titlen As String = If(rssSubNode IsNot Nothing, rssSubNode.InnerText, "")
rssSubNode = rssNode.SelectSingleNode("pubDate")
ndate = If(rssSubNode IsNot Nothing, rssSubNode.InnerText, "")
MsgBox(titlen & vbNewLine & link & vbNewLine & ndate)
Next
请指导我如何解决这个问题...