我正在尝试使这段代码正常工作但不知何故没有获得内容
我的代码
Dim m_xmld As XmlDocument
Dim m_nodelist As XmlNodeList
Dim m_node As XmlNode
'Create the XML Document
m_xmld = New XmlDocument()
'Load the Xml file
m_xmld.Load("http://feeds.thescore.com/nfl.rss")
'Get the list of name nodes
m_nodelist = m_xmld.SelectNodes("/rss/channel/item")
Dim content As XmlNamespaceManager = New XmlNamespaceManager(m_xmld.NameTable)
content.AddNamespace("content", "http://schemas.xmlsoap.org/soap/envelope/")
'Loop through the nodes
For Each m_node In m_nodelist
If Not m_node.SelectSingleNode("content:encoded",content) Is Nothing AndAlso Len(m_node.SelectSingleNode("content:encoded",content).InnerText) > 0 Then
response.Write(m_node.SelectSingleNode("content:encoded",content))
response.Flush()
end if
Next
有人能帮助我吗?
答案 0 :(得分:0)
我这样做了,可以看到所有内容节点,看起来像是html。
Imports <xmlns:atom="http://www.w3.org/2005/Atom">
Imports <xmlns:content="http://purl.org/rss/1.0/modules/content/">
Imports <xmlns:dc="http://purl.org/dc/elements/1.1/">
Imports <xmlns:georss="http://www.georss.org/georss">
Imports <xmlns:media="http://search.yahoo.com/mrss/">
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim xe As XElement = XElement.Load("http://feeds.thescore.com/nfl.rss")
Dim ie As IEnumerable(Of XElement) = xe...<content:encoded>
For Each c As XElement In ie
Debug.WriteLine(c.Value)
Next
End Sub
End Class
答案 1 :(得分:0)
我用不同的方法管理我首先导入数据,用webClient取代了with并像魅力一样工作