write the encoded version of a given string
if (xmlString == null) {
return;
}
int length = xmlString.length();
char character;
for (int i = 0; i < length; i++) {
character = xmlString.charAt( i );
switch (character) {
// we don't care about single quotes since axis will
// use double quotes anyway
case '&":
writer.write(AMP);
break;
case '"":
writer.write(QUOTE);
break;
case '<":
writer.write(LESS);
break;
case '>":
writer.write(GREATER);
break;
case '\n":
writer.write(LF);
break;
case '\r":
writer.write(CR);
break;
case '\t":
writer.write(TAB);
break;
default:
if (character < 0x20) {
throw new IllegalArgumentException(Messages.getMessage(
"invalidXmlCharacter00",
Integer.toHexString(character),
xmlString.substring(0, i)));
} else if (character > 0x7F) {
writer.write("");
writer.write(Integer.toHexString(character).toUpperCase());
writer.write(";");
} else {
writer.write(character);
}
break;
}
}