XSD documentation not carried over to C#

Apr 5, 2011 at 5:29 PM

Hi Pascal,


First of all I want to thank you for creating and maintaining this professional-grade product! Xsd2code is a great replacement to XSD.EXE at every step of the way. Xsd2code offers a wealth of powerful yet flexible features that truly make a difference when generating code from an XSD.


I ran into an issue with C# comment generation on Xsd2code 3.5 Beta: at the class level, I always get the default "MyClass class constructor" doc comment regardless of the XSD comments I provide in the <xs:annotation><xs:documentation></xs:documentation></xs:annotation> tags. For properties, there is no C# doc comment generated at all. I was able to reproduce the issue with a small XSD file if you would like to take a look.


Is the doc comment generation a missing feature in Xsd2code 3.5 Beta or is it a regression from previous versions? Thanks!

Apr 8, 2011 at 10:30 PM

Hi erwanh,

thank you for your feedbak.

Yes, you can send me your xsd sample at xsd2code@gmail.com. I don't work on the projet at this time but i hope soon for new release .


May 8, 2011 at 8:58 PM

I too experienced the same issue.  Any workaround for that?

Thanks for a great tool!


May 24, 2011 at 12:41 AM

Same problem. 

Do you have any update?

I have just started playing around this software, but it seems very, very powerful.

Thank you.


Aug 30, 2011 at 3:43 PM

My apologies for a reponse blackout. I did not get a chance to try Pascal's suggested reolsution until very recently. XSD comments can be imported (at least partially) to the generated code by adding a root element, then a sequence. Xsd2Code manages to import the element comment below. By the way, XSD.exe seems to have the same requirement in order to import XSD comments into generated code.

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="com/company/application" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:pivots="com/company/application" elementFormDefault="qualified" attributeFormDefault="unqualified">
  <xs:element name="rootElement">
        <xs:element name="Company" type="pivots:CompanyType">
            <xs:documentation>All Companies.</xs:documentation>

In this example, the comment "All Companies." is successfully imported in the generated code. Based on Pascal's feedback, some comments are left out nentheless (for instance, type comments), which would require some in-depth debugging of Xsd2Code. I am not aware of any plans to address this specific issue in later versions of Xsd2Code.

Best regards,


Feb 22, 2013 at 4:05 PM
I had a similar problem and found out that annotations are not rendered into summary comments when the annotated element is a child of an <xs:all/> element.
Dec 4, 2013 at 8:48 PM
I am having the same problem, but without <xs:all/> element also the documentation is missing from the elements:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" id="repository" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:sch="http://www.ascc.net/xml/schematron" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop">
<!-- schema definition --> <xs:element name="RepositoryDatabase" type="icn_database_v" msdata:IsDataSet="true" id="RepositoryDatabase">
<xs:complexType name="icn_fields_v">
  <xs:element name="fid_id"                                   type="xs:long"          maxOccurs="1" minOccurs="1" nillable="false" >
      Gets or sets the ID of the field.