question

Tatyana avatar image
Tatyana asked

Processing XML from web by SSIS 2005

Hi, I have an assignment to set up a SSIS package to download data from web. Basically, this is financial statistics organized in tables, each with a "Download to Spreadsheet" option. They used to do this manually, but apparently there is a need to automate this process. With HTTP connection manager and a Script task I am able to download the whole XML content of a web page into a file, but then I’m not sure what to do. I hoped to use this file as a XML source, but the XSD schema cannot be generated because it’s not a well-formed XML. What I came up: treating the file’s content as a string I truncate it before and after the table that contains the data needed, and then parse that remaining piece of XML. To do this I actually bulk-load files to the SQL and do all the work there… This looks rather like an artificial and awkward solution for me. So, my question is: are there smart ways to download and process a piece of XML from a web-page? Thank you.
sql-server-2005ssisxmlwebinterface
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
Scot Hauder avatar image
Scot Hauder answered
If only all web sites were xhtml compliant...take a look at the html agility pack http://htmlagilitypack.codeplex.com/ It can properly form the html so you can read it into xdocuments and manipulate with linq/xpath/xslt
3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Thank you, Scot. I'll try your suggestion and be back with the results in a couple of days...
0 Likes 0 ·
Let us know how it goes. You could also use a webbrowser control to grab the elements you are interested in, elements = WebBrowser1.Document.GetElementsByTagName("td") then enumerate through them... and then there is always regex
0 Likes 0 ·
@Scot, thank you so much for pointing out to the agility pack. It's working! I would not be able to find this source on my own. Also, let me publish here my thanks to the http://www.4guysfromrolla.com/articles/011211-1.aspx article, because on the codeplex.com they don't give much comments on how to use their pack...
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.