@Override
  public XmlAttributeValue handleContentChange(@NotNull XmlAttributeValue element, @NotNull TextRange range, String newContent) throws IncorrectOperationException {
    CheckUtil.checkWritable(element);

    String text;
    final String oldText = element.getText();
    try {
      String textBeforeRange = oldText.substring(0, range.getStartOffset());
      String textAfterRange = oldText.substring(range.getEndOffset());
      newContent = oldText.startsWith("'") || oldText.endsWith("'") ?
                   newContent.replace("'", oldText.contains("&#39;") ? "&#39;" : "&apos;") :
                   newContent.replace("\"", oldText.contains("&#34;") ? "&#34;" : "&quot;");
      text = "<a value=" + textBeforeRange + newContent + textAfterRange;
    } catch(StringIndexOutOfBoundsException e) {
      LOG.error("Range: " + range + " in text: '" + oldText + "'", e);
      throw e;
    }
    final Project project = element.getProject();
    final XmlTag tag = element.getParent().getParent() instanceof HtmlTag ?
                       XmlElementFactory.getInstance(project).createHTMLTagFromText(text) :
                       XmlElementFactory.getInstance(project).createTagFromText(text);
    final XmlAttribute attribute = tag.getAttribute("value");
    assert attribute != null && attribute.getValueElement() != null;
    element.getNode().replaceAllChildrenToChildrenOf(attribute.getValueElement().getNode());
    return element;
  }
@Override
  public XmlAttributeValue handleContentChange(@NotNull XmlAttributeValue element, @NotNull TextRange range, String newContent)