Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 What no XmlDocument...?

Author  Topic 

JBelthoff
Posting Yak Master

173 Posts

Posted - 2007-06-06 : 12:59:49
OK I am working on a SSIS package and am using a script task. I have to get remote xmldocuments from a server. Sounds simple enough. In C# it was easy but for some reason vb.net will not let me do this:

I can do a httpwebrequest and get the xml string into a variable strResponse

But the following will not work. The XmlDocument doesn't exists in the script task the vb code. On a side note I am importing Imports System.Xml in case anyone asks.


Dim doc As New XmlDocument
doc.LoadXml(strResponse)


Could anyone tell me how I would parse the xml elements using a script task?

here is the full code I am working with but all of the xml stuff has that blue squggly line underneathit.


Private Function ParseXmlIntoList(ByVal strResponse As String, ByVal l As List(Of StockInfo)) As List(Of StockInfo)

Dim doc As New XmlDocument

Try
doc.LoadXml(strResponse)
Catch
isError = True
Return l
End Try

Dim root As XmlElement = doc.DocumentElement
Dim list As XmlNodeList = root.SelectNodes("/StockData/Stock")

Dim x As Integer = 0

Dim n As XmlNode
For Each n In list
If l((x + intStartCount)).Symbol = getXMLElement(n, "Symbol") Then
l((x + intStartCount)).Price = Convert.ToDecimal(getXMLElement(n, "Last"))
l((x + intStartCount)).CompanyName = getXMLElement(n, "Name")
x += 1
Else

isError = True
Return l
End If
Next n

intStartCount = intStartCount + 25

Return l

End Function


Any help would be greatly appreciated.

Thanks,


JBelthoff
• Hosts Station is a Professional Asp Hosting Provider
• Position SEO can provide your company with SEO Services at an affordable price
› As far as myself... I do this for fun!

JBelthoff
Posting Yak Master

173 Posts

Posted - 2007-06-07 : 11:28:25
OK,

Just in case anyone was wondering, I needed to add a reference to System.Xml.Dll in the references. Once I did this everything worked as expected.

Silly huh?

Thanks,

JBelthoff
• Hosts Station is a Professional Asp Hosting Provider
• Position SEO can provide your company with SEO Services at an affordable price
› As far as myself... I do this for fun!
Go to Top of Page
   

- Advertisement -