Srđan Popić
Srđan Popić

Reputation: 1271

Free tool to automaticaly document XSD

When you create XML for some communication or as a configuration file, you will probably want to explain to others how this file works. What tag is used for what.

First, you will create XSD, where you will define how to create and use XML. And there are the annotation and documentation tags to explain it better. But, is there a tool how to convert XSD into documentation that is more readable to common users? For example in set od html files or in tex or pdf file.

If it have relationship images, that would be even better, but this is not a must.

Upvotes: 0

Views: 278

Answers (1)

Srđan Popić
Srđan Popić

Reputation: 1271

This could be the one solution I found out.

Using this xsl https://en.wikipedia.org/wiki/Xs3p, XSD can be converted into the html. You only need to compile XSD and XSL. Here is the example in python:

import lxml.etree as ET

dom = ET.parse('MY_XML_SCHEMA.xsd')
xslt = ET.parse('xs3p.xsl')
transform = ET.XSLT(xslt)
newdom = transform(dom)
with open('MY_XML_SCHEMA.html', 'w') as html:
    html.write(ET.tostring(newdom, pretty_print=True))

Upvotes: 1

Related Questions