简体   繁体   English

如何格式化XSD文档?

[英]How to format XSD documentation?

The Problem: 问题:

I have a xsd schema with included documentation, like: 我有一个包含随附文档的xsd架构,例如:

<xs:element name="Tag" type="XTag">
  <xs:annotation>
    <xs:documentation>
      Do like this:
       - foo
       - bar
    </xs:documentation>
  </xs:annotation>
</xs:element>

When I view the documentation in Eclipse, the white-spaces are truncated to a single space, so I end up with: 当我在Eclipse中查看文档时,空格被截断为单个空格,因此我最终得到:

Do like this: - foo - bar

This naturally limits readability when documentation is more than a little note. 当文档多于一点注释时,这自然会限制可读性。 In javadoc for instance, one can one html tags to format the documentation 例如,在javadoc中,一个可以html标记格式化文档的格式

The question: 问题:

Is there any way to format the documentation, at least just adding newlines? 有什么方法可以格式化文档,至少只是添加换行符?

Some details: 一些细节:

I'm doing everything in Eclipse. 我正在Eclipse中进行所有操作。 The XSD i write is added to preferences -> XML -> XML catalog , so I can get content assist and view documentation in the XML editor. 我编写的XSD已添加到preferences -> XML -> XML catalog ,因此我可以获得内容帮助,并可以在XML编辑器中查看文档。

It's an internal tool and the only foreseeable place the documentation will be viewed is through Eclipse in the way described above. 这是一个内部工具,可以预见的唯一可查看文档的位置是通过Eclipse以上述方式进行。 So if it works in eclipse, it's good enough :) 因此,如果它能在日食中工作,那就足够了:)

Try using html like <br/> for newline and List<ul><li>item</li></ul> for list items. 尝试使用HTML像<br/>对换行和List<ul><li>item</li></ul>列表项。

Not sure if you should be embedding "under construction" animated gifs or even tables though. 不知道您是否应该嵌入“正在构建中”的GIF动画甚至表格。 It worked for me while documenting an xsd and creating a corresponding xml using oXygen XML editor. 它对我有用,同时记录了xsd并使用oXygen XML编辑器创建了相应的xml。

Embed your documentation into <![CDATA[ ]]> and use html expressions. 将您的文档嵌入到<![CDATA[ ]]>并使用html表达式。 Sample below should be rendered correctly. 下面的示例应正确呈现。

<xs:annotation>
    <xs:documentation>
    <![CDATA[
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.<br/>
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. 
<p><b>Duis aute</b> irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. </p>
<br/>
<b>Excepteur sint occaecat cupidatat non proident,<br/>
<ul>
    <li>sunt in culpa qui officia</li> 
    <li>deserunt mollit anim</li>
    <li>id est laborum.</li>
</ul>
    ]]>
    </xs:documentation>
</xs:annotation>

Tested with Spring Tool Suite v3.6.4 (Eclipse 4.4.2) 使用Spring Tool Suite v3.6.4(Eclipse 4.4.2)进行了测试

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM