StringBuilder filteredXhtml = new StringBuilder();
if (message.getFirstChild() != null) {
// Render an XHTML string containing the message content, with embedded
// <ph> elements.
StringBuilder xhtml = new StringBuilder();
RenderContext rc = new RenderContext(new Concatenator(xhtml))
.withMarkupRenderMode(MarkupRenderMode.XML);
for (Node c : Nodes.childrenOf(message)) {
Nodes.render(c, rc);
}
rc.getOut().noMoreTokens();