Robb Hill
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 /descripti on")
For Each xmln In xmlnlist
Dim description = xmln.InnerText
lblXML.Text += vbCrLf + description + vbCrLf + vbCrLf
Next
Catch ex As Exception
Console.WriteLine(ex.Messa ge)
End Try
End Sub
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
For Each xmln In xmlnlist
Dim description = xmln.InnerText
lblXML.Text += vbCrLf + description + vbCrLf + vbCrLf
Next
Catch ex As Exception
Console.WriteLine(ex.Messa
End Try
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.