return "(NULL)";
}
if (cs.length() == 0) {
return "(zero-length-string)";
}
FastStringBuffer sb = new FastStringBuffer(FastStringBuffer.SMALL);
int len = cs.length();
for (int i=0; i<len; i++) {
char c = cs.charAt(i);
switch (c) {
case '\n':
sb.append("\\n");
break;
case '\t':
sb.append("\\t");
break;
case '\r':
sb.append("\\r");
break;
// case '\\':
// sb.append("\\\\");
// break;
default:
if (c < 32 || c > 255) {
sb.append("\\u");
String hex = Integer.toHexString(c);
while (hex.length() < 4) {
hex = "0" + hex;
}
sb.append(hex);
} else {
sb.append(c);
}
}
}
String s;
if (len > 30) {
if (valueType == ELEMENT && sb.charAt(0) == '{') {
StructuredQName qn = StructuredQName.fromClarkName(sb.toString());
String uri = qn.getNamespaceURI();
if (uri.length() > 15) {
uri = "..." + uri.substring(uri.length()-15);
}
s = "{" + uri + "}" + qn.getLocalName();
} else if (valueType == URI) {
s = "..." + sb.toString().substring(len-30);
} else {
s = sb.toString().substring(0, 30) + "...";
}
} else {
s = sb.toString();
}
switch (valueType) {
case ELEMENT:
return "<" + s + ">";
case ATTRIBUTE: