XmlFile (DomElement domElement) { if (domElement instanceof DomFileElement) { return ((DomFileElement<?>)domElement).getFile(); } DomInvocationHandler handler = DomManagerImpl.getDomInvocationHandler(domElement); assert handler != null : domElement; while (true) { if (handler instanceof DomRootInvocationHandler) { return ((DomRootInvocationHandler)handler).getParent().getFile(); } XmlTag tag = handler.getXmlTag(); if (tag != null) { return getContainingFile(tag); } DomInvocationHandler parent = handler.getParentHandler(); if (parent == null) { throw new AssertionError("No parent for " + handler.toStringEx()); } handler = parent; } }