public CMAttributeDeclaration getCMAttributeDeclaration(Attr attr) {
   CMAttributeDeclaration result = null;
   Element element = attr.getOwnerElement();
   if (element != null) {
     CMElementDeclaration ed = getCMElementDeclaration(element);
     if (ed != null) {
       result = (CMAttributeDeclaration) ed.getAttributes().getNamedItem(attr.getName());
       if (result == null) {
         // try to get the unprefixed name
         String name = DOMNamespaceHelper.getUnprefixedName(attr.getName());
         result = (CMAttributeDeclaration) ed.getAttributes().getNamedItem(name);
       }
       if (result == null) {
         // todo... perhaps this is a globally defined attribute...
       }
     }
   }
   return result;
 }