Пример #1
0
  /**
   * This reports that a comments is parsed. If not in the DTD, this comment is added to the current
   * JDOM <code>Element</code>, or the <code>Document</code> itself if at that level.
   *
   * @param ch <code>ch[]</code> array of comment characters.
   * @param start <code>int</code> index to start reading from.
   * @param length <code>int</code> length of data.
   * @throws SAXException
   */
  public void comment(char[] ch, int start, int length) throws SAXException {

    if (suppress) return;

    flushCharacters();

    String commentText = new String(ch, start, length);
    if (inDTD && inInternalSubset && (expand == false)) {
      internalSubset.append("  <!--").append(commentText).append("-->\n");
      return;
    }
    if ((!inDTD) && (!commentText.equals(""))) {
      if (atRoot) {
        factory.addContent(document, factory.comment(commentText));
      } else {
        factory.addContent(getCurrentElement(), factory.comment(commentText));
      }
    }
  }