tags:

views:

265

answers:

3

Hello.

Good day.

I want to parse a complex XML schema file and export to a C# file.

Does i need take use System.XML.Schema namespace ?

I don't know how to start my job.

Thanks in advance.

BR! Nano

+3  A: 

You need to use the XSD tool. It does have limitations but it is free and likely already on your system.

If you need bigger and costlier guns I'd suggest Liquid Xml Studio or Altova.

typeseven
Thank you sir Typtseven too. I think i could study XSD tool and try to work out my SR.Appreciated for your resource.BR!Nano
Nano HE
+1  A: 

XSD Object Gen is better than the XSD tool in my experience.

Winston Smith
Nano HE
+1  A: 

You can use XSD.EXE, and the command will be something like this:

XSD.EXE your.xsd /c

The generated source has a couple of quirks:

  • It generates [SerializableAttribute], [XmlTypeAttribute], [XmlRootAttribute], etc., rather than [DataContract] and [DataMember], which may (not) be a problem for you.
  • It defines child/detail structures using arrays within, rather than generic List<T> structures.

I usually have to tweak it fairly heavily (with a few search & replace operations), plus manually handling the lists. Regardless, it provides a good starting point.

Mike Hanson
Hi Sir Mike, Good day. I followed your command from .net 2.0 SDK command line, and i generated my C# file from my XSD file successfully. I am research more about my new C# file.thank you.Nano
Nano HE