void () { XmlFile xhtmlFile = (XmlFile)PsiFileFactory.getInstance(getProject()).createFileFromText("dummy.xml", "<html><body/></html>"); final XmlTag rootTag = xhtmlFile.getDocument().getRootTag(); rootTag.getSubTags()[0].getNamespace(); // fill the cache ApplicationManager.getApplication().runWriteAction(() -> { rootTag.setAttribute("xmlns", "http://www.ru"); }); assertEquals("http://www.ru", rootTag.getSubTags()[0].getNamespace()); }