private void writeXMLContent(String content,boolean escapeChars,boolean escapeDoubleQuotes) throws XMLStreamException {
  if (!escapeChars) {
    _writer.write(content);
    return;
  }
  int startWritePos=0;
  final int end=content.length();
  for (int index=0; index < end; index++) {
    char ch=content.charAt(index);
    if (!_writer.canEncode(ch)) {
      _writer.write(content,startWritePos,index - startWritePos);
      _writer.write(ENCODING_PREFIX);
      _writer.write(Integer.toHexString(ch));
      _writer.write(SEMICOLON);
      startWritePos=index + 1;
      continue;
    }
switch (ch) {
case OPEN_START_TAG:
      _writer.write(content,startWritePos,index - startWritePos);
    _writer.write("&lt;");
  startWritePos=index + 1;
break;
case AMPERSAND:
_writer.write(content,startWritePos,index - startWritePos);
_writer.write("&amp;");
startWritePos=index + 1;
break;
case CLOSE_START_TAG:
_writer.write(content,startWritePos,index - startWritePos);
_writer.write("&gt;");
startWritePos=index + 1;
break;
case DOUBLEQUOT:
_writer.write(content,startWritePos,index - startWritePos);
if (escapeDoubleQuotes) {
_writer.write("&quot;");
}
 else {
_writer.write(DOUBLEQUOT);
}
startWritePos=index + 1;
break;
}
}
_writer.write(content,startWritePos,end - startWritePos);
}

private void writeXMLContent ( String content , boolean escapeChars , boolean escapeDoubleQuotes ) throws XMLStreamException { if ( ! escapeChars ) { _writer . write ( content ) ; return ; } int startWritePos = 0 ; final int end = content . length ( ) ; for ( int index = 0 ; index < end ; index ++ ) { char ch = content . charAt ( index ) ; if ( ! _writer . canEncode ( ch ) ) { _writer . write ( content , startWritePos , index - startWritePos ) ; _writer . write ( ENCODING_PREFIX ) ; _writer . write ( Integer . toHexString ( ch ) ) ; _writer . write ( SEMICOLON ) ; startWritePos = index + 1 ; continue ; } switch ( ch ) { case OPEN_START_TAG : _writer . write ( content , startWritePos , index - startWritePos ) ; _writer . write ( "&lt;" ) ; startWritePos = index + 1 ; break ; case AMPERSAND : _writer . write ( content , startWritePos , index - startWritePos ) ; _writer . write ( "&amp;" ) ; startWritePos = index + 1 ; break ; case CLOSE_START_TAG : _writer . write ( content , startWritePos , index - startWritePos ) ; _writer . write ( "&gt;" ) ; startWritePos = index + 1 ; break ; case DOUBLEQUOT : _writer . write ( content , startWritePos , index - startWritePos ) ; if ( escapeDoubleQuotes ) { _writer . write ( "&quot;" ) ; } else { _writer . write ( DOUBLEQUOT ) ; } startWritePos = index + 1 ; break ; } } _writer . write ( content , startWritePos , end - startWritePos ) ; }
writes xml content to underlying writer . escapes characters unless escaping character feature is turned off .
