Project Description
An XML data binder for C#, this utility creates C# classes used for strongly typed access to XML data, given an XML schema as input.

This utility is similar in purpose to .NET's built-in xsd.exe utility, but considerably more powerful.

Releases
I haven't produced an official release yet, but I am working on it and hope to have one available soon. In the meantime, you can check out the source code and use the two binary files that are found in the .../Trunk/Src/bin/Release directory. xgs.exe is the command line interface, and XmlGenSharp.dll is the Visual Studio custom tool add-in.

Interfaces
XmlGen# is available in two flavors:
  • You can run it from the command line via xgs.exe. This is nice when you want to invoke the utility from build scripts, etc.
  • It integrates with the Visual Studio custom tool architecture. This is very convenient and let's you automatically regenerate output files without having to invoke the command line utility.

Types of Input Files Supported
  • You can give XmlGen# a plain old .XSD XML Schema file. You have limited control over the output when using this method, but you can control the name of the .NET namespace that the classes are generated into. For the VS custom tool, specify the namespace in the "Custom Tool Namespace" associated with the .XSD file. For the command line, use the -ns:<namespacehere> option.
  • You can use an XML file with an extension of .XGS. The option is similar to using a .XSD file, but you specify a reference to your schema, and you can then specify various other options that let you control the generated output.
  • XmlGen# includes a special mode for generating C# classes that correspond to enumerations. This mode is used when the input file ends with .XENUM.

Project Motivation
The technique of loading an XML file into a strongly-typed set of classes is known an XML Data Binding. There are many tools available to perform XML data binding. Some are open source. Some are commercial. Most of them are written to target a specific language. The parsing and error handling capabilities of each tool varies. I couldn't find a tool that did everything I wanted an XML data binder to do, so I decided to start this project. It is written in C# and generates C# classes. Depending on the level of interest, I may support other languages in the future.

Last edited Feb 5, 2009 at 6:28 PM by kdietz65, version 7