@Nullable public static XmlDocument getRealXmlDocument(@Nullable XmlDocument doc) { if (doc == null) return null; final PsiFile containingFile = doc.getContainingFile(); final PsiFile templateFile = TemplateLanguageUtil.getTemplateFile(containingFile); if (templateFile instanceof XmlFile) { return ((XmlFile)templateFile).getDocument(); } return doc; }
@Nullable public static XmlContentDFA getContentDFA(@NotNull XmlTag parentTag) { if (TemplateLanguageUtil.isInsideTemplateFile(parentTag)) return null; XmlContentDFA contentDFA = XsContentDFA.createContentDFA(parentTag); if (contentDFA != null) return contentDFA; return XmlContentDFAImpl.createContentDFA(parentTag); }