How to format XSD documentation?

六月ゝ 毕业季﹏ 提交于 2019-12-22 08:16:40

问题


The Problem:

I have a xsd schema with included documentation, like:

<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:

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

The question:

Is there any way to format the documentation, at least just adding newlines?

Some details:

I'm doing everything in 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.

It's an internal tool and the only foreseeable place the documentation will be viewed is through Eclipse in the way described above. So if it works in eclipse, it's good enough :)


回答1:


Embed your documentation into <![CDATA[ ]]> and use html expressions. 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)




回答2:


Try using html like <br/> for newline and List<ul><li>item</li></ul> for list items.

Not sure if you should be embedding "under construction" animated gifs or even tables though. It worked for me while documenting an xsd and creating a corresponding xml using oXygen XML editor.



来源:https://stackoverflow.com/questions/11105118/how-to-format-xsd-documentation

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!