private void writeEsc(char ch[],int start,int length,boolean isAttVal) throws SAXException {
  for (int i=start; i < start + length; i++) {
switch (ch[i]) {
case '&':
      write("&amp;");
    break;
case '<':
  write("&lt;");
break;
case '>':
write("&gt;");
break;
case '\"':
if (isAttVal) {
write("&quot;");
}
 else {
write('\"');
}
break;
default :
if (!unicodeMode && ch[i] > '\u007f') {
write("&#");
write(Integer.toString(ch[i]));
write(';');
}
 else {
write(ch[i]);
}
}
}
}

private void writeEsc ( char ch [ ] , int start , int length , boolean isAttVal ) throws SAXException { for ( int i = start ; i < start + length ; i ++ ) { switch ( ch [ i ] ) { case '&' : write ( "&amp;" ) ; break ; case '<' : write ( "&lt;" ) ; break ; case '>' : write ( "&gt;" ) ; break ; case '\"' : if ( isAttVal ) { write ( "&quot;" ) ; } else { write ( '\"' ) ; } break ; default : if ( ! unicodeMode && ch [ i ] > '' ) { write ( "&#" ) ; write ( Integer . toString ( ch [ i ] ) ) ; write ( ';' ) ; } else { write ( ch [ i ] ) ; } } } }
write an array of data characters with escaping .
