code: @Override
      public final void writeTypedElement(AsciiValueEncoder enc,
              XMLValidator validator, char[] copyBuffer)
          throws IOException, XMLStreamException
      {
          if (mSurrogate != 0) {
              throwUnpairedSurrogate();
          }
  
          /* Ok, this gets trickier: can't use efficient direct-to-bytes
           * encoding since validator won't be able to use it. Instead
           * have to use temporary copy buffer.
           */
          final int copyBufferLen = copyBuffer.length;
  
          // Copy buffer should never be too small, no need to check up front
          do {
              int ptr = enc.encodeMore(copyBuffer, 0, copyBufferLen);
  
              // False -> can't be sure it's the whole remaining text
              validator.validateText(copyBuffer, 0, ptr, false);
              writeRawAscii(copyBuffer, 0, ptr);
          } while (!enc.isCompleted());
      }
docs: Validating version of typed write method