void () { final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<a xmlns=\"aNamespace\"/>"); final XmlTag childTag = rootTag.createChildTag("b", "bNamespace", null, true); assertEquals("bNamespace", childTag.getNamespace()); WriteCommandAction.runWriteCommandAction(null, () -> { XmlTag beanTag = (XmlTag)rootTag.add(childTag); assertEquals("bNamespace", beanTag.getNamespace()); }); }