Example #1
0
  /**
   * Flush the given string into the document. This is a protected method so subclassers can control
   * text handling without knowledge of the internals of this class.
   *
   * @param data string to flush
   */
  protected void flushCharacters(String data) throws SAXException {
    if (data.length() == 0) {
      previousCDATA = inCDATA;
      return;
    }

    /**
     * This is commented out because of some problems with the inline DTDs that Xerces seems to
     * have. if (!inDTD) { if (inEntity) { getCurrentElement().setContent(factory.text(data)); }
     * else { getCurrentElement().addContent(factory.text(data)); }
     */
    if (previousCDATA) {
      factory.addContent(getCurrentElement(), factory.cdata(data));
    } else {
      factory.addContent(getCurrentElement(), factory.text(data));
    }

    previousCDATA = inCDATA;
  }