private void setText(String value, boolean defaultPolicy) {
    try {
      XmlText text = null;
      if (value != null) {
        final XmlText[] texts = getTextElements();
        if (texts.length == 0) {
          text = (XmlText)myTag.add(XmlElementFactory.getInstance(myTag.getProject()).createDisplayText("x"));
        } else {
          text = texts[0];
        }
        if (StringUtil.isEmpty(value)) {
          text.delete();
        }
        else {
          if (defaultPolicy && text instanceof XmlTextImpl) {
            ((XmlTextImpl)text).doSetValue(value, new DefaultXmlPsiPolicy());
          } else {
            text.setValue(value);
          }
        }
      }

      for (final XmlTagChild child : myElements) {
        if (child != text) {
          child.delete();
        }
      }
    }
    catch (IncorrectOperationException e) {
      LOG.error(e);
    }
  }
private void setText(String value, boolean defaultPolicy)