code: public static void replaceComment(CommentGenerator commentGenerator, XmlElement element) {
          Iterator<Element> elementIterator = element.getElements().iterator();
          boolean flag = false;
          while (elementIterator.hasNext()) {
              Element ele = elementIterator.next();
              if (ele instanceof TextElement && ((TextElement) ele).getContent().matches(".*<!--.*")) {
                  flag = true;
              }
  
              if (flag) {
                  elementIterator.remove();
              }
  
              if (ele instanceof TextElement && ((TextElement) ele).getContent().matches(".*-->.*")) {
                  flag = false;
              }
          }
  
          XmlElement tmpEle = new XmlElement("tmp");
          commentGenerator.addComment(tmpEle);
  
          for (int i = tmpEle.getElements().size() - 1; i >= 0; i--) {
              element.addElement(0, tmpEle.getElements().get(i));
          }
      }
docs: 替换已有注释
  @param commentGenerator
  @param element