Java 类com.intellij.psi.impl.source.parsing.xml.DtdParsing 实例源码

项目:intellij-ce-playground    文件:XmlEntityDeclImpl.java   
@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);
}
项目:tools-idea    文件:XmlEntityDeclImpl.java   
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);
}
项目:intellij-ce-playground    文件:DTDParserDefinition.java   
@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();
    }
  };
}
项目:tools-idea    文件:DTDParserDefinition.java   
@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();
    }
  };
}
项目:consulo-xml    文件:XmlEntityDeclImpl.java   
@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);
}
项目:intellij-ce-playground    文件:XmlElementType.java   
@Override
public ASTNode parse(CharSequence text, CharTable table) {
  return new DtdParsing(text, XML_MARKUP_DECL, DtdParsing.TYPE_FOR_MARKUP_DECL, null).parse();
}
项目:intellij-ce-playground    文件:XmlParsingTest.java   
private CompositeElement parseManually(final String value, final IElementType xmlElementDecl, XmlEntityDecl.EntityContextType parseType) {
  return (CompositeElement)new DtdParsing(value, xmlElementDecl, parseType, null).parse();
}
项目:tools-idea    文件:XmlElementType.java   
public ASTNode parse(CharSequence text, CharTable table) {
  return new DtdParsing(text, XML_MARKUP_DECL, DtdParsing.TYPE_FOR_MARKUP_DECL, null).parse();
}
项目:tools-idea    文件:XmlParsingTest.java   
private CompositeElement parseManually(final String value, final IElementType xmlElementDecl, XmlEntityDecl.EntityContextType parseType) {
  return (CompositeElement)new DtdParsing(value, xmlElementDecl, parseType, null).parse();
}
项目:consulo-xml    文件:XmlElementType.java   
public ASTNode parse(CharSequence text, CharTable table) {
  return new DtdParsing(text, XML_MARKUP_DECL, DtdParsing.TYPE_FOR_MARKUP_DECL, null).parse();
}