void () { @Language("XML") String xml = "<div><![CDATA[ ]]></div>"; XmlFile file = (XmlFile)PsiFileFactory.getInstance(getProject()).createFileFromText("foo.xml", XmlFileType.INSTANCE, xml); XmlTag root = file.getDocument().getRootTag(); final XmlText text = root.getValue().getTextElements()[0]; assertEquals(" ", text.getValue()); assertEquals(9, text.displayToPhysical(0)); assertEquals(13, text.displayToPhysical(1)); }