I’m working on a REST interface to an existing database, so I needed to create some validation tools for POSTed documents. I chose RELAX NG for the schemas.
Eric van der Vlist wrote a tool, examplotron, to create RELAX NG schemas from example XML documents. I’ve used these sorts of generators before, but examplotron understands annotations to the example document. It really does compile the comments.
So I was able to add hints to a sample file:
<foo xmlns:eg="http://examplotron.org/0/">
<bar eg:occurs="+">Hello world</bar>
</foo>
and reduced the amount of post-generation tweaking needed.
And examplotron’s written in XSLT, so all I needed was a XSLT tool to use it.
Then I use pantor.com’s RngToRnc style sheet to generate documentation.