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