PsiElement (PsiElement element) { if (element == null) return null; PsiElement res = element instanceof XmlProlog ? element : element.getNextSibling(); if (res != null) { if (res instanceof XmlProlog prolog) { if (prolog.getChildren().length > 0) { res = prolog.getFirstChild(); } else { res = prolog.getNextSibling(); } } } else { if (element.getParent() instanceof XmlProlog) { res = element.getParent().getNextSibling(); } } return res; }