void () { @Language("HTML") String xml = """ <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" \txmlns:th="http://www.thymeleaf.org"> <td style="text-align: right" th:utext="'&euro; ' + ${{item.netPrice}}">XXX</td> </html>"""; XmlFile file = (XmlFile)PsiFileFactory.getInstance(getProject()).createFileFromText("foo.xml", XmlFileType.INSTANCE, xml); XmlTag root = file.getDocument().getRootTag(); XmlTag tag = root.findFirstSubTag("td"); XmlAttribute attribute = tag.getAttribute("th:utext"); XmlAttributeValueImpl value = (XmlAttributeValueImpl)attribute.getValueElement(); assertEquals("'&#8364; ' + ${{item.netPrice}}", attribute.getDisplayValue()); LiteralTextEscaper<XmlAttributeValueImpl> escaper = value.createLiteralTextEscaper(); int offset = escaper.getOffsetInHost(31, new TextRange(1, 31)); assertEquals(31, offset); }