PsiElement (PsiFile baseFile, EntityContextType contextType, final XmlEntityRef originalElement) { PsiElement dep = XmlElement.DEPENDING_ELEMENT.get(getParent()); PsiElement dependsOnElement = getValueElement(dep instanceof PsiFile ? (PsiFile)dep : baseFile); String value = null; if (dependsOnElement instanceof XmlAttributeValue attributeValue) { value = attributeValue.getValue(); } else if (dependsOnElement instanceof PsiFile file) { value = file.getText(); } if (value == null) return null; DtdParsing dtdParsing = new DtdParsing(value, XML_ELEMENT_DECL, contextType, baseFile); PsiElement generated = dtdParsing.parse().getPsi().getFirstChild(); if (contextType == EntityContextType.ELEMENT_CONTENT_SPEC && generated instanceof XmlElementContentSpec) { generated = generated.getFirstChild(); } setDependsOnElement(generated, dependsOnElement); return setOriginalElement(generated, originalElement); }