XmlTag (String tagName) { XmlFile file = (XmlFile)PsiFileFactory.getInstance(getProject()).createFileFromText("tag.xml", XmlFileType.INSTANCE, "<" + tagName + "/>"); return file.getDocument().getRootTag(); }