XmlTag (@NonNls String tagName, Project project) { XmlFile file = (XmlFile)PsiFileFactory.getInstance(project).createFileFromText("tag.xml", "<" + tagName + "/>"); return file.getDocument().getRootTag(); }