XML is successful as a machine processable data interchange format, but it is often too verbose for human use. For this reason, many XML languages permit an alternative more legible non-XML syntax. XSLT stylesheets are often used to convert from the XML syntax to the alternative syntax; however, such transformations are not reversible since no general tool exists to automatically parse the alternative syntax back into XML.
XSugar makes it possible to manage dual syntax for XML languages. An XSugar specification is built around a context-free grammar that unifies the two syntaxes of a language. Given such a specification, the XSugar tool can translate from alternative syntax to XML and vice versa. Moreover, the tool statically checks that the transformations are reversible (i.e. bidirectional) and that all XML documents generated from the alternative syntax are valid according to a given XML schema.
- Research paper: Dual Syntax for XML Languages [ abstract | PDF (journal version) | BibTeX ]
- See the presentation of XSugar from DBPL'05 [ PowerPoint ]
- Download the XSugar tool: xsugar-all.jar (Java 6 is required). This is a proof-of-concept implementation - it's fairly stable (both the two-way translation and the validity & reversibility analyses) but speed and memory usage aren't overwhelmingly impressive :-)
- View the online javadoc API specifications.
- See the command-line usage and examples.
- Grammar for XSugar specifications.
- Source code is available on request.