@Override public PsiElement parse(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) { XmlAttributeValue attributeValue = (XmlAttributeValue)dependsOnElement; value = attributeValue.getValue(); } else if (dependsOnElement instanceof PsiFile) { PsiFile file = (PsiFile)dependsOnElement; 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); }
public PsiElement parse(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) { XmlAttributeValue attributeValue = (XmlAttributeValue)dependsOnElement; value = attributeValue.getValue(); } else if (dependsOnElement instanceof PsiFile) { PsiFile file = (PsiFile)dependsOnElement; 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); }
@NotNull @Override public PsiParser createParser(Project project) { return new PsiParser() { @NotNull @Override public ASTNode parse(IElementType root, PsiBuilder builder) { return new DtdParsing(root, XmlEntityDecl.EntityContextType.GENERIC_XML, builder).parse(); } }; }
@Override public PsiElement parse(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) { XmlAttributeValue attributeValue = (XmlAttributeValue) dependsOnElement; value = attributeValue.getValue(); } else if(dependsOnElement instanceof PsiFile) { PsiFile file = (PsiFile) dependsOnElement; 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); }
@Override public ASTNode parse(CharSequence text, CharTable table) { return new DtdParsing(text, XML_MARKUP_DECL, DtdParsing.TYPE_FOR_MARKUP_DECL, null).parse(); }
private CompositeElement parseManually(final String value, final IElementType xmlElementDecl, XmlEntityDecl.EntityContextType parseType) { return (CompositeElement)new DtdParsing(value, xmlElementDecl, parseType, null).parse(); }
public ASTNode parse(CharSequence text, CharTable table) { return new DtdParsing(text, XML_MARKUP_DECL, DtdParsing.TYPE_FOR_MARKUP_DECL, null).parse(); }