SweetXML User Guide

Table of Contents

Adding SweetXML Support to Your App

Detailed docs on this are forthcoming. In brief, you use an instance of net.innig.sweetxml.SweetToXmlConverter to turn a SweetXML input source into an input source containing plain old XML. The SweetToXmlConverter can map between any combination of a String, Reader, InputStream, or SAX InputSource, which should allow you to interface with just about any XML parser.

Your XML parsing code probably has a line that looks something like this:

mySaxParser.parse(myInput, mySaxHandler);

Before parsing the normal XML, look first for the file extension .sxml. If it exists, parse it like this:

mySaxParser.parse(
    new SweetToXmlConverter(myInput).getResultInputSource(),
    mySaxHandler);

And your're done! This example uses SAX, but a very similar approach works with other parsers.

Table of Contents
innig