We don’t allow questions seeking开发者_JS百科 recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this questionDoes anyone know if there is an XSD file somewhere that can be used to validate the XML documentation that gets generated when you compile a C# project with the /doc option?
I want to modify that file manually after it's been generated and I'm looking for an easy way to confirm that I haven't damaged the structure of the file.
Thanks.
I finally broke down and wrote one: XSD for Xml Comments for .NET Documentation
Stumbled across this old question today.. I didn't see this by looking at Microsoft's documentation, nor when looking at other projects that I thought might have an interest in developing such a schema; namely, the sources for the Sandcastle and (long-defunct) NDoc projects.
Short of stepping back to try to define a schema on your own, one thing I could suggest would be to use one of the many tools that will generate an XSD from XML. Microsoft includes XSD.EXE
as part of Visual Studio and its SDKs.
You could write up dummy source that exercises each of the XML documentation comment tags, build the XML documentation file for it, then use XSD.EXE
. to generate an XSD from that, and use it to validate the XML doc after your processing is done. But I think that could turn out to be less trivial than it sounds.
Also, XML documentation comments refer to types and code elements, and there are many things a schema won't catch; e.g., verifying that the name attribute of a <param>
tag still refers to an actual parameter name in your C# source. The compiler verifies such elements at build time. But if you post-process the XML documentation, you would need a custom tool that had a reference to the original C# source or generated assemblies to re-verify such references.
精彩评论