Ah, ok, I understand the confusion.
Currently yes, the code is one by one character, but however in the same "method" which tends to be optimized, compared to a method called each and every time (compare getByte() to getBytes(byte[]) then looping on array).

However the remarks on going are more on the request from Trustin about using a Pattern instead of a method as currently implemented. Therefore, the code will look like:


    if (! pattern.matcher(name).matches())

instead of

    if (! isValidHtml4Name(name)) 

so replacing the method isValidHtml4Name by a call to a "supposed to be" more efficient way (pattern.matcher) and moreover more flexible for the user (he/she can implement the pattern he wants instead of the current logic which is all or nothing).

Sorry for the confusion...