Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include the xsd:documentation in the C# class generated with XSD.exe?

I am using xsd.exe to generate a C# class from a collection of xsd files. The xsd file makes use of the <xsd:documentation> tag to include useful descriptions. Example:

<xsd:complexType name="AddressType">
    <xsd:annotation>
        <xsd:documentation>A formatted or free form address and its intended use.</xsd:documentation>
    </xsd:annotation>

Unfortunately all of this is lost in the generated C# class. Interestingly each class has an empty remarks documentation tag attached to it.

/// <remarks/>

How can I include this documentation in the generated C# class (either in or documentation tags)?

like image 423
Jim McKeeth Avatar asked Feb 06 '10 01:02

Jim McKeeth


2 Answers

xsd.exe is based on Codedom.

You could disassemble xsd.exe, and add the functionality there and recompile. The code is reasonably simple.

I had modified it to skip some namespaces from xsd while generating code.[Otherwise If I include a common.xsd in 2 other xsds the class was getting generated twice.]

Granted, I had access to source proper itself [I was a developer at Microsoft], but the process should be simple with diassembled code as well.

like image 108
Fakrudeen Avatar answered Oct 30 '22 20:10

Fakrudeen


Sorry, there's no way to do this.

like image 25
John Saunders Avatar answered Oct 30 '22 22:10

John Saunders