String (Object element) { String elementValue = null; if(element instanceof PsiNamedElement){ if (element instanceof XmlTag) { elementValue = ((XmlTag)element).getLocalName(); } else { elementValue = ((PsiNamedElement)element).getName(); } } else if (element instanceof PsiElement) { elementValue = ((PsiElement) element).getText(); } return elementValue; }