Search code examples
htmlxsdwsdlumlibm-rational

How to view xsd:documentation that is in HTML markup?


I am generating WSDL/XSD for SOAP services from a UML model using IBM Rational Software Architect (RSA). RSA allows you to document the classes and attributes in the model using rich-formatting.

For example, I have the following documentation on a Trailer class:

A wheeled Vehicle that is designed for towing by another Vehicle. Known subtypes include:

  • Caravan
  • BoxTrailer
  • BoatTrailer

When the UML model is transformed to WSDL/XSD (using the out-of-the-box UML to WSDL transform), the formatting is preserved as HTML markup inside the xsd:documentation element:

  <xsd:complexType name="Trailer">
    <xsd:annotation>
      <xsd:documentation>&lt;p&gt;
    A&amp;nbsp;wheeled &lt;strong&gt;Vehicle&lt;/strong&gt; that is designed for&amp;nbsp;towing by another &lt;strong&gt;Vehicle.&lt;/strong&gt; Known
    subtypes include:&amp;nbsp;
&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;
        &lt;strong&gt;Caravan&lt;/strong&gt;
    &lt;/li&gt;
    &lt;li&gt;
        &lt;strong&gt;BoxTrailer&lt;/strong&gt;
    &lt;/li&gt;
    &lt;li&gt;
        &lt;strong&gt;BoatTrailer&lt;/strong&gt;
    &lt;/li&gt;
&lt;/ul&gt;</xsd:documentation>
    </xsd:annotation>
  </xsd:complexType>

Unfortunately, this is really hard to read and I've been searching (with no luck) for a program that can view WSDL/XSD with documentation in HTML markup.

XmlSpy 2008 can't do it, RSA can't do it (which is a bit surprising, as it generated the XSD in the first place), neither can any web browser I've tried.

I did write a JET template that extracted the documentation from the model and outputted to HTML, and I could probably write some XSLT to do something similar from the XSD, but I was hoping there's a program out there (ideally free) that could view the documentation as HTML.

Essentially, I'd like to be able to tell the consumers of our web service that they can view the WSDL in X program if they want to read the documentation - does anybody know the best solution to this?

Edit: Thanks for the suggestions, but I think I have a solution! I didn't realise that RSA can export a WSDL to HTML (right-click on WSDL, export, HTML). The generated HTML has a graphical view of each schema element, the documentation for each element, as well as the original source, and everything is hyperlinked together.

Most importantly, the documentation is richly-formatted again! One small caveat is that the ;nbsp's appear in the HTML output. This seems to be because the ampersand is escaped in the HTML:

&amp;nbsp;

Instead it should be

&nbsp;

I will update my model-to-model transform to ensure that the ;nbsp's are replaced with real spaces (I don't believe I'll need non-breaking spaces in the documentation), so the generated WSDL/XSD won't ever have them.


Solution

  • This issue is fixed in RSA 8.0.4 - which now supports exporting to WSDL/XSD with plain text (as well as an option to sort the schema by type, then name alphabetically!).

    To view the the documentation in a WSDL/XSD generated from a UML model in prior versions of RSA, the easiest solution is to export the WSDL/XSD as HTML using RSA. You can do this by right-clicking on the WSDL/XSD, selecting export, then selecting HTML.

    The generated HTML has a graphical view of each schema element, the documentation for each element, as well as the original source, and everything is hyperlinked together.

    Most importantly, the documentation (that's virtually unreadable in the WSDL/XSD) is richly-formatted again! One small caveat is that the ;nbsp's that RSA's documentation editor inserts also appear in the HTML output. This seems to be because the ampersand is not only escaped in the WSDL/XSD (which is good), but also in the HTML (bad!):

    &amp;nbsp;

    Instead it should be

    &nbsp;

    A simple workaround to this is to replace all &amp;nbsp;'s in the WSDL/XSD with real spaces before generating the HTML.