in src/main/java/org/apache/commons/scxml2/io/ContentParser.java [104:129]
public static String spaceNormalizeContent(final String content) {
if (content != null) {
int index = 0;
final int length = content.length();
final StringBuilder buffer = new StringBuilder(length);
boolean whiteSpace = false;
while (index < length) {
if (isWhiteSpace(content.charAt(index))) {
if (!whiteSpace && buffer.length() > 0) {
buffer.append(' ');
whiteSpace = true;
}
}
else {
buffer.append(content.charAt(index));
whiteSpace = false;
}
index++;
}
if (whiteSpace) {
buffer.setLength(buffer.length()-1);
}
return buffer.toString();
}
return null;
}