* convert input
*/
final ConversionContext context = ConversionContextFactory
.newDefaultEnvironment();
final Converter c = new MabxmlToMabConverter();
c.getConverterContext()
.setSourceEncoding(MabxmlToMab.inputEncoding);
c.getConverterContext().setTargetEncoding(
MabxmlToMab.outputEncoding);
c.getConverterContext()
.setSourceFormat(
context.getFormat(ConversionContextFactory.DOCFORMATNAME_MABXML1));
c.getConverterContext()
.setTargetFormat(
context.getFormat(ConversionContextFactory.DOCFORMATNAME_MAB2));
context.addConverter(c);
final ConversionParameters params = new ConversionParameters();
params.setSourceCharset(MabxmlToMab.inputEncoding);
params.setTargetCharset(MabxmlToMab.outputEncoding);
final ByteArrayOutputStream bout = new ByteArrayOutputStream();
c.convert(MabxmlToMab.in, bout, params);
if (MabxmlToMab.outputEncoding.equals("x-MAB")
|| MabxmlToMab.outputEncoding.equals("x-PICA")) {
/*
* No normalization for x-PICA and x-MAB, since they
* NFD-normalize their input anyway