XMLChar { public static boolean isValidName(String name) { if (name.length() == 0) return false; char ch = name.charAt(0); if( isNameStart(ch) == false) return false; for (int i = 1; i < name.length(); i++ ) { ch = name.charAt(i); if( isName( ch ) == false ){ return false; } } return true; }  static boolean isSupplemental(int c); static int supplemental(char h, char l); static char highSurrogate(int c); static char lowSurrogate(int c); static boolean isHighSurrogate(int c); static boolean isLowSurrogate(int c); static boolean isValid(int c); static boolean isInvalid(int c); static boolean isContent(int c); static boolean isMarkup(int c); static boolean isSpace(int c); static boolean isNameStart(int c); static boolean isName(int c); static boolean isNCNameStart(int c); static boolean isNCName(int c); static boolean isPubid(int c); static boolean isValidName(String name); static boolean isValidNCName(String ncName); static boolean isValidNmtoken(String nmtoken); static final int MASK_VALID; static final int MASK_SPACE; static final int MASK_NAME_START; static final int MASK_NAME; static final int MASK_PUBID; static final int MASK_CONTENT; static final int MASK_NCNAME_START; static final int MASK_NCNAME; }
@Test public void testIsValidName() { assertFalse(XMLChar.isValidName("")); assertFalse(XMLChar.isValidName("df sdf")); assertFalse(XMLChar.isValidName(" dfsdf")); assertTrue(XMLChar.isValidName("dfsdf")); }