2016-07-24 5 views
0

私はこのコードが動作して取得しようとしていますが、何とかvb.net XmlDocument.SelectSingleNodeとxmlNamespace問題

マイコード

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

魅力のように働いた最初のインポート異なるアプローチで管理:エンコードされた値を。どのような反応があったのか分からなかった。 – dbasnett

答えて

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 
+0

asp.netバージョンのインポート方法としてはどのようにすればよいのですか?<%@ Import "% > – killair

0

私はWebクライアントとのデータに置き換えそして私の答えは、すべてのコンテンツを取得する方法を示して