@NotNull
  public XmlFile getContainingFile(@NotNull DomElement domElement) {
    if (domElement instanceof DomFileElement) {
      return ((DomFileElement) domElement).getFile();
    }
    DomInvocationHandler handler = DomManagerImpl.getDomInvocationHandler(domElement);
    assert handler != null : domElement;
    while (handler != null
        && !(handler instanceof DomRootInvocationHandler)
        && handler.getXmlTag() == null) {
      handler = handler.getParentHandler();
    }
    if (handler instanceof DomRootInvocationHandler) {
      return ((DomRootInvocationHandler) handler).getParent().getFile();
    }
    assert handler != null;
    XmlTag tag = handler.getXmlTag();
    assert tag != null;
    while (true) {
      final PsiElement parentTag = PhysicalDomParentStrategy.getParentTagCandidate(tag);
      if (!(parentTag instanceof XmlTag)) {
        return (XmlFile) tag.getContainingFile();
      }

      tag = (XmlTag) parentTag;
    }
  }
 @Override
 @NotNull
 public XmlFile getContainingFile(@NotNull DomElement domElement) {
   if (domElement instanceof DomFileElement) {
     return ((DomFileElement) domElement).getFile();
   }
   return DomManagerImpl.getNotNullHandler(domElement).getFile();
 }
 @NotNull
 public EvaluatedXmlName getEvaluatedXmlName(@NotNull final DomElement element) {
   return DomManagerImpl.getDomInvocationHandler(element).getXmlName();
 }
 @Override
 @NotNull
 public EvaluatedXmlName getEvaluatedXmlName(@NotNull final DomElement element) {
   return DomManagerImpl.getNotNullHandler(element).getXmlName();
 }