code: public void writeCharacters(Characters ch)
          throws XMLStreamException
      {
          // Need to finish an open start element?
          if (mStartElementOpen) {
              closeStartElement(mEmptyElement);
          }
  
          /* Not legal outside main element tree, except if it's all
           * white space
           */
          if (mCheckStructure) {
              if (inPrologOrEpilog()) {
                  if (!ch.isIgnorableWhiteSpace() && !ch.isWhiteSpace()) {
                      reportNwfStructure(ErrorConsts.WERR_PROLOG_NONWS_TEXT);
                  }
              }
          }
  
          if (mVldContent <= XMLValidator.CONTENT_ALLOW_WS) {
              if (mVldContent == XMLValidator.CONTENT_ALLOW_NONE) { // never ok
                  reportInvalidContent(CHARACTERS);
              } else { // all-ws is ok...
                  if (!ch.isIgnorableWhiteSpace() && !ch.isWhiteSpace()) {
                      reportInvalidContent(CHARACTERS);
                  }
              }
          } else if (mVldContent == XMLValidator.CONTENT_ALLOW_VALIDATABLE_TEXT) {
              if (mValidator != null) {
                  /* Last arg is false, since we do not know if more text
                   * may be added with additional calls
                   */
                  mValidator.validateText(ch.getData(), false);
              }
          }
  
          // Ok, let's just write it out:
          try {
              mWriter.writeCharacters(ch.getData());
          } catch (IOException ioe) {
              throw new WstxIOException(ioe);
          }
      }
docs: Method called by {@link javax.xml.stream.XMLEventWriter}
  (instead of more generic
  text output methods), so that we can verify (if necessary) that
  this character output type is legal in this context. Specifically,
  it's not acceptable to add non-whitespace content outside root
  element (in prolog/epilog).
  <p>
  Note: cut'n pasted from the main <code>writeCharacters</code>; not
  good... but done to optimize white-space cases.