微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何为xml文件注释生成doxygen文档?

我当前的项目是C应用程序.使用doxygen生成文档,并相应地格式化注释.
该项目还包括几个带注释的xml资源文件.我想将它们包含在文档中.

以下是我想要做的事情的说明:

输入(我的应用程序使用的文件,myFile.xml):

<!-- 
@brief settings used by class MyClass at startup
@image html screenshot_default.jpg
-->
<Myclass_settings id="default_setting">
  <param_1 value="1"/>
  <param_2 value="XXXXX"/>
</Myclass_settings>

<!-- 
@brief settings used by class MyClass - reserved to experienced users
@image html screenshot_advanced.jpg
-->
<Myclass_settings id="advanced_setting">
  <param_1 value="42"/>
  <param_2 value="WWWWW"/>
</Myclass_settings>

输出(由doxygen生成的文档):

myFile.xml File Reference
    Elements
        default_setting    
            settings used by class MyClass at startup
            [here screenshot_default is inserted]
        advanced_setting   
            settings used by class MyClass - reserved to experienced users      
            [here screenshot_advanced is inserted]

我该如何撰写评论,以及我需要哪些doxygen设置?

解决方法

AFAIK doxygen不支持记录XML文件.

我能想到的最简单的事情就是编写一个额外的文档文件,如问题/答案中所讨论的那样
How to include custom files in DoxygenHow to make an introduction page with Doxygen.在此文件中,您可以将输入XML文件的预期形式记录为单独的页面(使用\page命令).然后,此页面显示生成的文档的“相关页面”选项卡下.该文件看起来像(注意使用C/C++样式注释):

/* \page input_xml_page myFile.xml File Reference

\section elements Elements

Some preliminary discussion of the file goes here...

You can refer to both the default \ref default_settings and advanced settings
\ref default_settings sections like this.

\subsection default_settings Default settings

Settings used by class MyClass at startup
\image html screenshot_default.jpg

\subsection advanced_settings Advanced settings

Settings used by class MyClass - reserved to experienced users
\image html screenshot_advanced.jpg

*/

不幸的是,此方法将您的文档与XML文件分开.

或者,其他工具可以做你想要的.例如,请参阅此问题:
Can XML be documented using Doxygen,Sandcastle,or other documentation generators?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。