Click here to Skip to main content
15,867,453 members
Articles / Programming Languages / C#

Cinchoo - XSD GUI Tool

Rate me:
Please Sign up or sign in to vote.
4.92/5 (9 votes)
30 Mar 2016CPOL3 min read 36.8K   1.4K   19   7
GUI interface to Microsoft Xsd tool

Contents

  1. Introduction
  2. Features
  3. How to run
    1. Window Mode
    2. Tray Application Mode
    3. Console Mode
      1. Help
  4. Configuration

1. Introduction

Many times, we come across the need of parsing XML document and creating XML schema or common language runtime classes/entities. These entities are later passed between multiple methods, stored as configuration or used to perform some manipulation. Hand writing code for parsing these entities from XML document is tedious.

Microsoft has a nifty little tool called xsd.exe which lets you create serializable classes for the .NET framework from an XSD or XML file. Unfortunately, it doesn’t come with the latest versions of Visual Studio and you have to download the Windows SDK to get hold of it.

This article presents the new Cinchoo GUI interface to xsd.exe tool to parse XML documents and generate entities. This new interface is built using Cinchoo framework, using most of its features like Configuration, Command line parsing, Application host, binding to controls, etc. This is one of the working examples of building an application using this versatile .NET framework easily.

2. Features

Cinchoo Xsd tool provides the following features:

  1. Simplified GUI interface
  2. Support of Nested XML files (refer to Handling Nested Xml files article for more information about it)
  3. Can run as console mode (passing /#AM:Console as command line argument)
  4. Can run as tray application (on minimizing the window)

3. How To Run

This tool can be started as:

  • Console Application
  • Windows Application
  • Tray Application

3.1 Window Mode

By default, if you run the executable (ChoXsd.exe). This will start as Windows application. The main window looks like below:

Image 3.1.1 Main window

Image 1

  • XML File Path - Input XML file path
  • Output Directory - Destination directory where the generated files are created. If not specified, the generated files will be created under the input XML file directory.
  • Options - Please refer to the Microsoft Xsd.exe tool document for each option
  • Status - All the generation process status messages are posted
  • Generate - Button is to start the generation process
  • Cancel - Button to cancel the generation process

3.2 Tray Application Mode

Sometimes, you may want to keep this tool running all the time and quickly go back to get access to this tool to carry out generation of entities. In such cases, you can let them run in tray mode. By pressing 'minimize' button, the tool will be made to run in tray mode.

In this mode, the below features are available to you. These will be available when you right click on this tool application icon in tray taskbar.

  • Open - To restore the window
  • Always on Top - To keep the window as topmost of all other Windows applications
  • Run at System Startup - This option lets the application start up automatically when system starts
  • Show in Taskbar - To show the application in the Taskbar

3.3 Console Mode

This tool can be started as Console Application by passing /#AM:Console command line parameter to the executable.

Listing 3.3.1 Running as console mode
>ChoXsd.exe /#AM:Console

3.3.1 Help

To get help of the application, pass /? in command line.

Listing 3.3.1.1 Getting help
>ChoXsd.exe /#AM:Console /?
ChoXsd [Version 1.0.0.1]
Copyright c  2014

CHOXSD [/order] [/f] [/edb] [/n:<string>] [/l:<string>] [/e:<string>] [/o:<strin
g>] xmlfile [/c] [/eld] [/d]

        /order  Generate explicit order identifiers on all particle members.
        /f      Generate fields instead of properties.
        /edb    Implement INotifyPropertyChanged interface on all generated
                types to enable data binding..
        /n      The namespace for generated class files. The default
                namespace is the global namespace.
        /l      The language to use for the generated code. Choose from
                'CS', 'VB', 'JS', 'VJS', 'CPP' or provide a fully-qualified
                name for a class implementing
                System.CodeDom.Compiler.CodeDomProvider. The default
                language is 'CS' (CSharp).
        /e      Element from schema to process.
        /o      The output directory to create files in. The default is the
                current directory.
        xmlfile Name of an xml file to infer xsd schema from.
        /c      Generate classes for this schema.
        /eld    Generate LINQ-enabled sub-classed Dataset for the schemas
                provided.
        /d      Generate sub-classed DataSet for this schema.

Below is a screenshot of help.

Image 3.3.1.1 Console window

Image 2

4. Configuration

UPDATE

This application uses Microsoft Xsd.exe tool to generate entities. This program automatically discovers Xsd.exe tool under 'C:\Program Files\Microsoft SDKs\Windows' folder, remember it at startup. If you wish to use a different version of this tool (Xsd.exe) in a different location, you can configure it by opening [AppExe].config file and specifying Microsoft SDK path containing Xsd.exe tool in 'SDKDirectory' appsetting.

Listing 4.1 [AppExe].config file
XML
<?xml version="1.0"?>
<configuration>
    <appSettings>
        <add key="SDKDirectory" value="C:\Program Files\Microsoft SDKs\Windows" />
    </appSettings>
</configuration>

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionWin32Exception Pin
erickorlando23-Mar-16 8:35
erickorlando23-Mar-16 8:35 
AnswerRe: Win32Exception Pin
Cinchoo26-Mar-16 9:04
Cinchoo26-Mar-16 9:04 
QuestionNice Pin
Terence Wallace25-Nov-14 10:46
Terence Wallace25-Nov-14 10:46 
Just what the XML doctor ordered. Smile | :)
"If you feel the urge to add complexity, just go home early. You ain't gonna need it." - YAGNI

QuestionFrom a usability point of view, you might want to..... Pin
Peter Shaw24-Nov-14 4:14
professionalPeter Shaw24-Nov-14 4:14 
AnswerRe: From a usability point of view, you might want to..... Pin
Cinchoo25-Nov-14 8:53
Cinchoo25-Nov-14 8:53 
GeneralRe: From a usability point of view, you might want to..... Pin
Peter Shaw1-Dec-14 13:07
professionalPeter Shaw1-Dec-14 13:07 
QuestionMy vote of 5! Pin
Volynsky Alex12-Nov-14 4:02
professionalVolynsky Alex12-Nov-14 4:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.