Generate xmldoc comments for generated c# class using xsd.exe

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a schema file defining objects. I then use xsd to convert that schema into a C# class file. Is it possible to have xmldoc comments added to the generated c# file? I have attempted to add <xsd:annotation><xsd:documentation /> tags to various parts of the schema, but that does not appear to do anything.

Thanks

Jim
 
James,

I don't believe that this is possible. You will have to add the
comments yourself.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

James Geurts said:
Hi,

I have a schema file defining objects. I then use xsd to convert that
schema into a C# class file. Is it possible to have xmldoc comments added
to the generated c# file? I have attempted to add
 
Hi Jim,

Thank you for posting in the community! My name is Kevin, and I will be
assisting you on this issue.

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to make xsd.exe add comments
to the generated .cs file automatically. If there's any misunderstanding,
please feel free to point me out.

As far as I know, this cannot be achieved by xsd.exe automatically. I think
you have to do it manually. Each time the schema is modified, you have to
regenerate the .cs file. The comments will be lost. If you need to know
more about xsd.exe please refer to the following link:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cptools/htm
l/cpconxmlschemadefinitiontoolxsdexe.asp

Does this answer your question? If anything is unclear, please feel free to
reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Note that if you add them yourself, they will vanish every time the class is
regenerated (every time you change your xsd).

Nicholas Paldino said:
James,

I don't believe that this is possible. You will have to add the
comments yourself.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

James Geurts said:
Hi,

I have a schema file defining objects. I then use xsd to convert that
schema into a C# class file. Is it possible to have xmldoc comments added
to the generated c# file? I have attempted to add
Thanks

Jim
 
XSD.exe is just a CodeGen tool provided by microsoft with visual studio (and
a nice one at that).

Code Generation is available in the System.CodeDom and
System.CodeDom.Compiler namespaces, and as long as you feel like some real
lateral thinking its not _THAT_ hard to produce an xsd.exe -type tool that
turns an Xml document into a typed dataset. If that happens to be the same
Xml document you have, but you also parse the xsd:annotation elements to
produce code documentation then so be it.

If you look at the output of XSD.exe, and then look at the Xml that you use
to produce it you will see that its just a case of writing that recursive
function that looks through the Xml and produces the right code.




James Geurts said:
Hi,

I have a schema file defining objects. I then use xsd to convert that
schema into a C# class file. Is it possible to have xmldoc comments added
to the generated c# file? I have attempted to add
 
Back
Top