void () { final String value = "a \"b\" c"; final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<html foo='" + value + "'/>"); assertEquals(1, rootTag.getAttributes().length); assertEquals(value, rootTag.getAttributeValue("foo")); final XmlAttribute foo = rootTag.getAttribute("foo"); final String text = foo.getValueElement().getText(); assertEquals("'" + value + "'", text); ((PsiLanguageInjectionHost)foo.getValueElement()).updateText(text); assertEquals("<html foo='" + value + "'/>", rootTag.getText()); }