tags:

views:

385

answers:

2

Hello all,

Good day.

How to parse XML Schema(.xsd) file and generate to c# class file.

About my project:

Step1. Parse XSD file (C# lang) ----Build Time -----> Generate CCode Dictionary(C# Class)

Step2. Paser XML file(C# lang) ----Run Time -----> Fill the CCode Dictionary with the XML file value (C# App)

I researched the tools of XSD.exe / XSDObjectGen Tool etc. I found the C# class can't be used for my project.

That's why i want to parse the XSD file by myself. I searched MSDN and found the the information: Namespace: System.Xml.Schema But i don't know which class if better for me for using.

Any help will be appreciated.

BR! Nano

+1  A: 

In my project I successfully used xsd.exe to do this, with this command line:

xsd.exe schema.xsd /classes

What in the classes generated make them inappropriate for use in your project?

David Reis
+2  A: 

Or you can use the Xsd2Code command-line and Visual Studio add-in utility.

With Xsd2Code, you can right-click on a XSD file in your Visual Studio Solution Explorer and have it create the C# file for you:

alt text

marc_s
Hello marc_s,i found "Xsd2Code is an AddIn for visual studio 2008" from http://xsd2code.codeplex.com/.Does it work well for VS2005?Thanks a lot.
Nano HE
@Nano: I don't know - I am no longer using VS2005. What does the documentation say? If you're not sure - ask on the xsd2code discussion board at Codeplex.
marc_s