// We need to render the content of the anchor as a string.
Object contentObject = attributes.getContent();
if (contentObject instanceof DOMOutputBuffer) {
StringWriter contentWriter = new StringWriter();
DocumentOutputter outputter = new DOMDocumentOutputter(
new XMLDocumentWriter(contentWriter),
characterEncoder);
DOMOutputBuffer contentBuffer = (DOMOutputBuffer) contentObject;
Element contentRoot = contentBuffer.getRoot();
try {
outputter.output(contentRoot);
content = contentWriter.getBuffer().toString();
} catch (IOException ioe) {
logger.error("content-generation-error", ioe);
}
} else {