DataTable WriteXML Clean

DataTable , WriteXML , Clean Montreal, Canada
  • 11 years ago


    Vistual Studio 2008 – 3.5 SP1 MySQL Server 5.1.30

    My problem: I need to use the .WriteXml method of a DataTable to write the XML to a file or stream. This I can do. The real problem is the fact that additional attributes are included in my output (IsDataSet=True, etc...), when I use the System.Data.XmlWriteMode.WriteSchema parameter on the .WriteXML method. This poses a major problem as my Web Service has to deliver neutral/agnostic XML and NOT .NET related information.

    What follows is an example of what I am returned when using the .WriteXML method with the problematic attributes bolded for emphasis. I need to ensure interoperability with other platforms as well as include XML schema information so that it is self-describing; what I don’t need is any Microsoft, .NET, or DataSet related attributes.

    I just can't believe that .NET does not provide a method by which to emit CLEAN (BasicProfile 1.1 compliant) XML from a DataSet and/or DataTable and inserts its own .NET specific type information. Is what I am asking too complicated? I thought Web Services were supposed to ensure interoperability.

    Can you please help me output neutral XML from a DataTable?

    Method: clientDataTable.WriteXml(@"C:\test.xml", System.Data.XmlWriteMode.WriteSchema);


Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Java is to JavaScript what Car is to Carpet.” - Chris Heilmann