Package com.intellij.psi.xml

Examples of com.intellij.psi.xml.XmlDocument


     *
     * @return xml document (never {@code null})
     * @throws IncorrectOperationException
     */
    private XmlDocument ensureXmlDocument() throws IncorrectOperationException {
        final XmlDocument xmlDocument = getXmlDocument();
        if (xmlDocument == null)
            throw new IncorrectOperationException(RES.get("missing.xml.document"));

        return xmlDocument;
    }
View Full Code Here


     * tag path expression), {@code null} is returned. </p>
     *
     * @return the root tag, or {@code null}
     */
    private XmlTag getRootTag() {
        final XmlDocument xmlDocument = getXmlDocument();
        if (xmlDocument == null)
            return null;
        else {
            final XmlTag rootTag = xmlDocument.getRootTag();
            if (rootTag == null)
                return null;

            if (!rootTag.getName().equals(parseRootTagName()))
                return null;
View Full Code Here

     * @return the root tag (existing, or newly created) - never {@code null}
     * @throws IncorrectOperationException if the root already exists, but does not satisfy the tag
     *                                     path expression
     */
    private XmlTag ensureRootTag() throws IncorrectOperationException {
        final XmlDocument xmlDocument = ensureXmlDocument();
        XmlTag rootTag = xmlDocument.getRootTag();
        if (rootTag != null) {
            final String rootTagName = rootTag.getName();
            if (!rootTagName.equals(parseRootTagName()))
                throw new IncorrectOperationException(
                        RES.get("incorrect.root.tag", rootTagName));
            else
                return rootTag;
        }

        final Project project = file.getProject();
        final PsiManager psiMgr = PsiManager.getInstance(project);
        final PsiElementFactory eltFactory = psiMgr.getElementFactory();

        final String tagExpr = "<" + parseRootTagName() + "/>";
        rootTag = eltFactory.createTagFromText(tagExpr);
        return (XmlTag) xmlDocument.add(rootTag);
    }
View Full Code Here

                final PsiFile psiFile = psiMgr.getPsiFile(document);
                if (!(psiFile instanceof XmlFile))
                    return;

                final XmlFile xmlFile = (XmlFile) psiFile;
                final XmlDocument xmlDoc = xmlFile.getDocument();
                if (xmlDoc == null)
                    return;

                final XmlTag projectTag = xmlDoc.getRootTag();
                if (projectTag == null)
                    return;

                final XmlTag[] goals = projectTag.findSubTags("goal");
                final String goalName = pGoal.getName();
View Full Code Here

    final XmlFile xmlFile = JspManager.getInstance(module.getProject()).getTldFileByUri(taglibUri, module, null);
    if (xmlFile == null) {
      return;
    }

    final XmlDocument document = xmlFile.getDocument();
    if (document == null) {
      return;
    }

    final XmlNSDescriptor descriptor = (XmlNSDescriptor) document.getMetaData();
    if (descriptor == null) {
      return;
    }

    PsiElement declaration = descriptor.getDeclaration();
View Full Code Here

        return super.buildVisitor(holder, isOnTheFly);
    }

    protected void visitRoot(PsiFile psiFile, @NotNull ProblemsHolder holder, String root, String child, String tagName) {

        XmlDocument xmlDocument = PsiTreeUtil.getChildOfType(psiFile, XmlDocument.class);
        if(xmlDocument == null) {
            return;
        }

        Map<String, XmlAttribute> psiElementMap = new HashMap<String, XmlAttribute>();
View Full Code Here

        return jsClass;
    }

    private static XmlTag getRootTag(XmlFile xmlFile)
    {
        final XmlDocument document = xmlFile.getDocument();
        return document != null ? document.getRootTag() : null;
    }
View Full Code Here

TOP

Related Classes of com.intellij.psi.xml.XmlDocument

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.