Tobber
Tobber

Reputation: 7531

How to format XSD documentation?

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

Upvotes: 7

Views: 5602

Answers (2)

vahapt
vahapt

Reputation: 1705

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)

Upvotes: 6

jos
jos

Reputation: 823

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.

Upvotes: 3

Related Questions