TextSerializer serializer = new TextSerializer();
StringWriter writer = new StringWriter();
serializer.setOutputCharStream(writer);
ContentHandlerWrapper contentHandler = new ContentHandlerWrapper(serializer, serializer);
contentHandler.startDocument();
// TODO is root element necessary for TextSerializer?
contentHandler.startElement(JXTemplateGenerator.NS, elementName, elementName, EMPTY_ATTRS);
Invoker.execute(contentHandler, objectModel, executionContext, macroContext, namespaces, this.getNext(), this
.getEndInstruction());
contentHandler.endElement(JXTemplateGenerator.NS, elementName, elementName);
contentHandler.endDocument();
valueStr = writer.toString();
}
} catch (Exception exc) {
throw new SAXParseException(exc.getMessage(), getLocation(), exc);
}