471,594 Members | 2,599 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,594 software developers and data experts.

Using XSLT to transform XML prior to loading into Dataset

I am trying to transfor an XML document prior to loading into a
Dataset. My problem stems from the known bug in Visual Studio that
prevents loading a well formed XML because of duplicate child names:

http://support.microsoft.com/default...b;en-us;325696

Anyway, I want to transform the XML using the XSLT to get around this
problem, but I am having a tough time coming up with a way to apply
the XSLT before loading it into the dataset. Any help and sample code
appreciated.
Thanks in advance.
-Patrick
ps***********@hotmail.com
Nov 12 '05 #1
2 4366
The XslTransform class has an overload of the Transform method that returns
an XmlReader. Use that the load the DataSet.

"Patrick J. Schouten" <ps***********@hotmail.com> wrote in message
news:1b**************************@posting.google.c om...
I am trying to transfor an XML document prior to loading into a
Dataset. My problem stems from the known bug in Visual Studio that
prevents loading a well formed XML because of duplicate child names:

http://support.microsoft.com/default...b;en-us;325696

Anyway, I want to transform the XML using the XSLT to get around this
problem, but I am having a tough time coming up with a way to apply
the XSLT before loading it into the dataset. Any help and sample code
appreciated.
Thanks in advance.
-Patrick
ps***********@hotmail.com

Nov 12 '05 #2
Thanks. That worked great! Here is what I came up with. Let me know if
you have any comments. Thanks again.

Dim resolver As XmlUrlResolver = New XmlUrlResolver
resolver.Credentials =
System.Net.CredentialCache.DefaultCredentials

Dim xslt As New XslTransform
xslt.Load(CType("c:\mytest.xsl", String))

Dim myData As New XPath.XPathDocument("c:\myTest.xml")

Dim reader As XmlReader = xslt.Transform(myData, Nothing,
resolver)

ds.ReadXml(reader)

Me.DataGrid1.DataSource = ds

Patrick
ps***********@hotmail.com
"Dare Obasanjo [MSFT]" <da***@online.microsoft.com> wrote in message news:<#O**************@TK2MSFTNGP10.phx.gbl>...
The XslTransform class has an overload of the Transform method that returns
an XmlReader. Use that the load the DataSet.

"Patrick J. Schouten" <ps***********@hotmail.com> wrote in message
news:1b**************************@posting.google.c om...
I am trying to transfor an XML document prior to loading into a
Dataset. My problem stems from the known bug in Visual Studio that
prevents loading a well formed XML because of duplicate child names:

http://support.microsoft.com/default...b;en-us;325696

Anyway, I want to transform the XML using the XSLT to get around this
problem, but I am having a tough time coming up with a way to apply
the XSLT before loading it into the dataset. Any help and sample code
appreciated.
Thanks in advance.
-Patrick
ps***********@hotmail.com

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Wil | last post: by
3 posts views Thread by Matthias Marx | last post: by
7 posts views Thread by Doug Heeren | last post: by
reply views Thread by Terry Brown | last post: by
3 posts views Thread by thomas.porschberg | last post: by
2 posts views Thread by kamil.nowicki | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.