} catch (ParserConfigurationException e) {
throw new RuntimeException(e);
}
} else if (content instanceof TextContent) {
TextContent textContent = (TextContent) content;
TextConstruct textConstruct = textContent.getContent();
int type = textContent.getContent().getType();
String typeName;
String text;
switch (type) {
case TextConstruct.Type.HTML:
typeName = "html";
text = ((HtmlTextConstruct) textConstruct).getHtml();
break;
case TextConstruct.Type.TEXT:
typeName = "text";
text = ((PlainTextConstruct) textConstruct).getPlainText();
break;
case TextConstruct.Type.XHTML:
typeName = "xhtml";
text = ((XhtmlTextConstruct) textConstruct).getXhtml().getBlob();
break;
default:
typeName = "unknown";
text = textConstruct.toString();
}
Map<String, Object> entity = new HashMap<String, Object>();
entity.put("content", text);
entity.put("type", typeName);