CMDocument cm = getCMDocument();
if (cm != null) {
CMNamedNodeMap map = cm.getEntities();
if (map != null) {
CMEntityDeclaration decl = (CMEntityDeclaration) map.getNamedItem(name);
if (decl != null) {
String value = decl.getValue();
if (value == null)
return null;
int valueLength = value.length();
if (valueLength > 1 && value.charAt(0) == '&' && value.charAt(1) == '#' && value.charAt(valueLength - 1) == ';') {
// character reference