Examplotron: Instance Documents as Schemas

I created Examplotron from a very simple idea: when you want to describe the element foo, why work in yet another language, writing:

<element name='foo'><empty/></element>

or:

element foo {empty}

It’s so much simpler to just write the element in plain XML: <foo/>. Instead of describing instance documents, why couldn’t you just show them?

The first implementation, published with the original description of Examplotron, relied on two XSLT transformations. The Examplotron “schema” was compiled by an XSLT transformation into another XSLT transformation, which then performed the validation of the instance documents. The concept received many positive comments when I announced it, but it was very limited. Adding new features would have meant creating the full semantics of a new schema language. The implementation as an XSLT transformation became very complex and the project was stalled until I realized the potential of using RELAX NG as a target format instead.

Since the release of version 0.5, Examplotron has been implemented as an XSLT transformation that creates a RELAX NG schema. Thanks to this approach, Examplotron made more progress in two weeks than in two years under the previous architecture!

Tip

For more information on Examplotron, and to get the tools used for the transformations in this section, visit http://examplotron.org.

Ten-Minute Guide to Examplotron

Here’s a snippet of our example document:

 <?xml version="1.0" encoding="utf-8"?> <character ...

Get RELAX NG now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.