private String avNormalize(String value) {
        int i = 0;
        int len = value.length();
        while (i < len) {
            if (value.charAt(i) <= ' ') {
                break;
            }
            i++;
        }
        if (i == len) {
            return value;
        } else {
            StringBuilder builder = new StringBuilder(len);
            boolean prevWasWhitespace = true;
            for (int j = 0; j < len; j++) {
                char c = value.charAt(j);
                if (c <= ' ') {
                    if (!prevWasWhitespace) {
                        builder.append(c);
                        prevWasWhitespace = true;
                    }
                } else {
                    builder.append(c);
                    prevWasWhitespace = false;                    
                }
            }
            if (prevWasWhitespace) {
                builder.setLength(builder.length() - 1);
            }
            return builder.toString();
        }
    }
@see org.xml.sax.helpers.XMLFilterImpl#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
src/nu/validator/xml/IdFilter.java