e78990

Hello once again,

I know there must be a better way to do what my VB.NET program is currently doing:

I use a webservice that returns a XML file.

I save the xml file, then parse each node one by one. the innervalue is then appended to a sql query, the query is executed and the row in my Sybase db created.

Sometimes the node does not exist in the XML file, so I have to put a condition if for each of the nodes (if not exist, then create node)

I think I have to do more of a manual process because Sybase is not exactly supported in the version of VS that I am using, otherwise, I think pushing the xml to a SQL server would be easier.

Any suggestion about how to be more productive

Thanks,



Re: XML and the .NET Framework There must be a better way to do this...

Nikolay Glushnev

If you have control over database schema then you may have an option to load XML data directly to your database (without full conversion of the data to relational format). All major DBMS vendors have some level of XML support in their products. For example, MS SQL Server 2005 supports XML data as a native data type => you can execute queries like:
Code Snippet

CREATE TABLE docs (pk INT PRIMARY KEY, xCol XML not null)


INSERT INTO docs VALUES (2,
'<doc id="123">
<sections>
<section num="1"><title>XML Schema</title></section>
<section num="3"><title>Benefits</title></section>
<section num="4"><title>Features</title></section>
</sections>
</doc>')

SELECT xCol.query('/doc[@id = 123]//section')
FROM docs
WHERE xCol.exist ('/doc[@id = 123]') = 1

The article describes it in more detail:
http://msdn2.microsoft.com/en-us/library/ms345117.aspx






Re: XML and the .NET Framework There must be a better way to do this...

e78990

I will have to try that! That sounds a lot more like the easy xml I hear everywhere about!

Thanks