Document owner = a.getOwnerDocument();
Entity ent = null;
//search for the entity in the docType
//of the attribute's ownerDocument
if (owner != null) {
DocumentType docType = owner.getDoctype();
if (docType != null) {
NamedNodeMap entities = docType.getEntities();
ent = (Entity) entities.getNamedItemNS(
"*",
child.getNodeName());
}
}