Link to home
Start Free TrialLog in
Avatar of Robb Hill
Robb HillFlag for United States of America

asked on

Add nodes to a new xmldocument using vb.net

I have the following code below in which I am taking an rss feed and converting a section of it into a string.....

What I need to do...is take the node at each iteration of the For loop and add it back into a new xml.xmldocument....and then pass the full xml document to sqlserver adn store it as varchar I suppose...
not sure the best way to store it...but I need the entire xml file to be stored in one column of a database table.  My main concern is how to recreate the xml collection mentioned above....
Here is my code so far:


 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGrab.Click

        Dim xmldoc As New Xml.XmlDocument
        Dim xmlnlist As Xml.XmlNodeList
        Dim xmln As Xml.XmlNode
        Dim xmlRevDoc As New Xml.XmlDocument

        Try
            Dim strURL As String = "http://feeds.feedburner.com/wnbc/sports"

            xmldoc.Load(strURL)
            xmlnlist = xmldoc.SelectNodes("//item/description")

            For Each xmln In xmlnlist
                Dim description = xmln.InnerText
                lblXML.Text += vbCrLf + description + vbCrLf + vbCrLf
            Next
        Catch ex As Exception
            Console.WriteLine(ex.Message)
        End Try
    End Sub
ASKER CERTIFIED SOLUTION
Avatar of Colemss
Colemss
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial