Solved

xsd to xml

Posted on 2004-08-20
6
572 Views
Last Modified: 2012-05-05
Given an xsd file, is it possible to generate an xml file?





0
Comment
Question by:doudou74
  • 2
6 Comments
 
LVL 10

Expert Comment

by:eternal_21
ID: 11852214
An XSD file is in XML format.... what exactly are you trying to do?
0
 

Author Comment

by:doudou74
ID: 11852328
I have a schema .xsd,
and i need to get a .xml file that corresponds to this xsd.

a .xsd defines just the structure.
the xml file contains data values.


0
 
LVL 10

Accepted Solution

by:
eternal_21 earned 125 total points
ID: 11853158
Do you have a Strongly Typed dataset in your application?  You can produce the XML string with this:

  public static string WriteDataSet(System.Data.DataSet dataSet)
  {
    System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
    dataSet.WriteXml(memoryStream, System.Data.XmlWriteMode.WriteSchema);
    memoryStream.Seek(0, System.IO.SeekOrigin.Begin);
    return new System.IO.StreamReader(memoryStream).ReadToEnd();
  }

Personally, I use the System.Data.XmlWriteMode.IgnoreSchema option.
0
 
LVL 10

Expert Comment

by:123654789987
ID: 11868188
You can do it using some tools using XmlSpy.

If you want to do it programatically there is a tool called XML Schema Definition Tool (Xsd.exe)
You can get information about this tool from MSDN.

There is a particular option called XSd sample.xsd /d  which
Generates a class derived from DataSet that corresponds to the specified schema.
Then from this dataset
To read XML data into the derived class, use the System.Data.DataSet.ReadXml method.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now