code: protected final void charactersFlush()
    {
  
      if (m_textPendingStart >= 0)  // -1 indicates no-text-in-progress
      {
        int length = m_chars.size() - m_textPendingStart;
        boolean doStrip = false;
  
        if (getShouldStripWhitespace())
        {
          doStrip = m_chars.isWhitespace(m_textPendingStart, length);
        }
  
        if (doStrip) {
          m_chars.setLength(m_textPendingStart);  // Discard accumulated text
        } else {
          // Guard against characters/ignorableWhitespace events that
          // contained no characters.  They should not result in a node.
          if (length > 0) {
            // If the offset and length do not exceed the given limits
            // (offset < 2^21 and length < 2^10), then save both the offset
            // and length in a bitwise encoded value.
            if (length <= TEXT_LENGTH_MAX
                    && m_textPendingStart <= TEXT_OFFSET_MAX) {
              m_previous = addNode(m_coalescedTextType, DTM.TEXT_NODE,
                               m_parents.peek(), m_previous,
                               length + (m_textPendingStart << TEXT_LENGTH_BITS),
                               false);
  
            } else {
              // Store offset and length in the m_data array if one exceeds 
              // the given limits. Use a negative dataIndex as an indication.
              int dataIndex = m_data.size();
              m_previous = addNode(m_coalescedTextType, DTM.TEXT_NODE,
                                 m_parents.peek(), m_previous, -dataIndex, false);
  
              m_data.addElement(m_textPendingStart);
              m_data.addElement(length);
            }
          }
        }
  
        // Reset for next text block
        m_textPendingStart = -1;
        m_textType = m_coalescedTextType = DTM.TEXT_NODE;
      }
    }
docs: Check whether accumulated text should be stripped; if not,
  append the appropriate flavor of text/cdata node.