The Artima Developer Community
Sponsored Link

.NET Buzz Forum
More About DataSets and Interop

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Peter G Provost

Posts: 849
Nickname: pprovost
Registered: Aug, 2003

Peter G Provost is a Solution Architect for Interlink Group in Denver, CO.
More About DataSets and Interop Posted: Sep 5, 2003 6:37 PM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Peter G Provost.
Original Post: More About DataSets and Interop
Feed Title: Peter Provost's Geek Noise
Feed URL: /error.aspx?aspxerrorpath=/Rss.aspx
Feed Description: Technology news, development articles, Microsoft .NET, and other stuff...
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Peter G Provost
Latest Posts From Peter Provost's Geek Noise

Advertisement

Gordon Weakliem comments:

I don't get your comment about "vague concerns over interoperability". Name a non-Microsoft SOAP stack that can serialize a DataSet. I don't know of any. I'd call that a real concern over interoperability. AFAIK, the schema for the DataSet wire format isn't publicly available

I guess what I meant was that I didn't have any hard evidence about it. It felt wrong precisely because I didn't know if a non-MS SOAP stack could deserialize it.

Now since the schema for a particular DataSet is available via the WriteXmlSchema method, I decided to find out how hard it would be... it seems to me that you should be able to deserialize it in any language.

To see what a DataSet schema looks like, I fired up Snippet Compiler and entered the following code:

using System; 

using System.Data;

public class MyClass
{
public static void Main()
{
DataSet ds = new DataSet();
DataTable table = ds.Tables.Add( "MyTable" );
DataColumn col1 = table.Columns.Add( "Col1", typeof(System.String) );
DataColumn col2 = table.Columns.Add( "Col2", typeof(System.Int32) );

table.Rows.Add( new object[] { "a", 1 } );
table.Rows.Add( new object[] { "b", 2 } );

ds.WriteXml( "C:\\dataset.xml" );
ds.WriteXmlSchema( "C:\\dataset.xsd" );
}
}

I ran the code and got the following XSD file:

<?xml version="1.0" standalone="yes"?> <xs:schema xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" 

xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns=""
id="NewDataSet"> <xs:element name="NewDataSet" msdata:IsDataSet="true"> <xs:complexType> <xs:choice maxOccurs="unbounded"> <xs:element name="MyTable"> <xs:complexType> <xs:sequence> <xs:element name="Col1" type="xs:string"
minOccurs="0"/> <xs:element name="Col2" type="xs:int"
minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> </xs:choice> </xs:complexType> </xs:element> </xs:schema>

And the following XML file:

<?xml version="1.0" standalone="yes"?> <NewDataSet> <MyTable> <Col1>a</Col1> <Col2>1</Col2> </MyTable> <MyTable> <Col1>b</Col1> <Col2>2</Col2> </MyTable> </NewDataSet>

So it seems to me that anyone who wanted to could deserialize a DataSet, because it is essentially just an XML Infoset at heart. The problem with using DataSets in Web Services is not that they are proprietary, but that the way they are defined in the WSDL is bad. I think maybe you could solve this with a WSDL First approach, but I'm not sure.

Anyone?

Read: More About DataSets and Interop

Topic: A Customers Bill Of Rights Previous Topic   Next Topic Topic: Outlook 2003 Keyboard Shortcut

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use