Home  /  Blog  /  Documentation  /  Code Generator

Code generator

XSD & JSON Code generation tool

Efficient, Low Cost XML Data Binding and XML-to-Code Generation Speeds Your Project's Time-To-Market.

The complexity of producing well constructed, reliable class libraries from XML & JSON schema can challenge any project's timeline and development team's productivity. The xsd2code++ code generation tool substantially streamlines and simplifies a project's development and maintenance time by automatically serializing objects into XML and deserializing XML into C# or VB.

Image showing the schema to code process

Saving parameters

xsd2code++ is a code generator that does not require any external library to be executed. This is a strength of the product because it does not require you to deploy dlls with your project.

The code once compiled in your project is directly distributable without having to integrate a license key for its execution.

The parameters are saved in the header of the source file in JSON format. :

// ------------------------------------------------------------------------------
//  <auto-generated>
//    Generated by Xsd2Code++. Version www.xsd2code.com
//    {"TargetFramework":5,"NameSpace":"MyProject.MyNameSpace","CollectionObjectType":4,"Properties":{"PropertyNameSpecified":{}},"XmlAttribute":{},"WCFAttribute":{},"JsonAttribute":{},"DataAnnotationsAttribute":{},"ClassParams":{},"GenericBaseClass":{},"Serialization":{"ShouldSerialize":{},"XmlSerializerEvent":{},"XmlOutput":{"Formating":true},"JsonOutput":{"DateFormatString":null},"Enabled":true,"DefaultSerializer":2},"TrackingChanges":{},"Miscellaneous":{},"GenerateCloneMethod":true}
//  </auto-generated>
// ------------------------------------------------------------------------------
#pragma warning disable
namespace MyProject.MyNameSpace
    using System;
    using System.Diagnostics;
    using System.Xml.Serialization;
    using System.Collections;
    using System.Xml.Schema;
    using System.ComponentModel;
    using Newtonsoft.Json;
    using System.IO;
    using System.Text;
    using System.Collections.Generic;
    public partial class PurchaseOrderType

The headers contains the code generation parameters that can be retrieved and applied to another cases.

Launch the code generator from Visual Studio

To launch the generator from Visual Studio, simply select the XSD or JSON schema. The context menu of the Solution Explorer opens the code generator.

xsd2code++ contextual menu

It is also possible with the context menu to convert a JSON schema to XSD or vice versa.

Enable automatic code generation via the CustomTool

Using the CustomTool allows you to regenerate the code as soon as the schema is changed. To activate it you have to add Xsd2CodeCustomTool in the properties.

  • Select your Scheme
  • Add Xsd2CodeCustomTool in properties
Image showing the CustomTool activation

If generated code already exists, the CustomTool will use the parameters found in the header of the *.designer.cs file. Otherwise, a new file will be generated with the default parameters of the code generator.

Image showing the generated firstDesigner