XmlCharacters { public static boolean isValidNameStart( int c ) { return c < NUMBER_OF_CHARACTERS && (MASKS[c] & NAME_START_CHARACTER) != 0; } private  XmlCharacters(); static boolean isValidNameStart( int c ); static boolean isValidNcNameStart( int c ); static boolean isValidName( int c ); static boolean isValidNcName( int c ); static boolean isValidPubid( int c ); static boolean isValid( int c ); static boolean isValidContent( int c ); static boolean isValidSpace( int c ); static boolean isValidName( String name ); static boolean isValidNcName( String name );  }
@Test public void shouldNotAllowDigitAsFirstCharacterInName() { assertThat(XmlCharacters.isValidNameStart('0'), is(false)); assertThat(XmlCharacters.isValidNameStart('1'), is(false)); assertThat(XmlCharacters.isValidNameStart('2'), is(false)); assertThat(XmlCharacters.isValidNameStart('3'), is(false)); assertThat(XmlCharacters.isValidNameStart('4'), is(false)); assertThat(XmlCharacters.isValidNameStart('5'), is(false)); assertThat(XmlCharacters.isValidNameStart('6'), is(false)); assertThat(XmlCharacters.isValidNameStart('7'), is(false)); assertThat(XmlCharacters.isValidNameStart('8'), is(false)); assertThat(XmlCharacters.isValidNameStart('9'), is(false)); }
@Test public void shouldAllowLettersAsFirstCharacterInName() { for (char c = 'a'; c <= 'z'; ++c) { assertThat(XmlCharacters.isValidNameStart(c), is(true)); } for (char c = 'A'; c <= 'Z'; ++c) { assertThat(XmlCharacters.isValidNameStart(c), is(true)); } }