2

We have several XSD files and one of them has the root element and others are imported or included. These XSD files represents an XML service request... for documentation reason, I need to extract all the element names and attributes under the root element.

What I need is to produce something like this:

<table>
  <tr>
     <td>ELELEMENT OR ATTRIBUTE NAME</td> 
     <td>Whether or not mandatory - by checking minOccurs="0"</td>
     <td>EMPTY OR THE TEXT VALUE under annotation/documentation IF AVAILABLE</td>
  </tr> 
</table>
Mads Hansen
  • 63,927
  • 12
  • 112
  • 147
xbmono
  • 2,084
  • 2
  • 30
  • 50

3 Answers3

2

You might like to consider rendering the schema using Michael Sperberg-McQueen's stylesheet at http://www.w3.org/2008/09/xsd.xsl, or adapting this to your requirements. It works best when the schema contains extensive XHTML-formatted documentation.

Michael Kay
  • 156,231
  • 11
  • 92
  • 164
  • We have Oxygen which generates a very nice HTML documentation but what I need is a simple table of all the elements in our schema in the output. It must be simple... my knowledge in xml stylesheet is very low ... I tried to create one but no luck! – xbmono Sep 08 '14 at 23:17
1

There are several tools to generate HTML from sets of XSD schema documents; some are listed at the W3C page on XSD. The page is increasingly out of date, but many of the tools it lists are still available.

C. M. Sperberg-McQueen
  • 24,596
  • 5
  • 38
  • 65
1

I made an xslt stylesheet that does exactly what you asked for: https://github.com/S2-/xsddoc

Simon
  • 422
  • 5
  • 19