public static final void checkName(char[] ch, int start, int length) throws NullPointerException, IndexOutOfBoundsException, InvalidXMLException {

        // Minimum length is 1
        if (length < 1) {
            throw new InvalidXMLException("An empty string does not match the 'Name' production.");
        }

        // First char must match: (Letter | '_' | ':')
        int i = start;
        char c = ch[i];
        if (c != '_' && c != ':' && !isLetter(c)) {
            throw new InvalidXMLException("The character 0x" + Integer.toHexString(c) + " is invalid as a starting character in the 'Name' production.");
        }

        // Loop through the array and check each character
        for (i++; i < length; i++) {
            c = ch[i];

            if (!isNameChar(c)) {
                throw new InvalidXMLException("The character 0x" + Integer.toHexString(c) + " is not valid for the 'Name' production.");
            }
        }
    }
public static final void checkName ( char [ ] ch , int start , int length ) throws NullPointerException , IndexOutOfBoundsException , InvalidXMLException { if ( length < 1 ) { throw new InvalidXMLException ( "An empty string does not match the 'Name' production." ) ; } int i = start ; char c = ch [ i ] ; if ( c != '_' && c != ':' && ! isLetter ( c ) ) { throw new InvalidXMLException ( "The character 0x" + Integer . toHexString ( c ) + " is invalid as a starting character in the 'Name' production." ) ; } for ( i ++ ; i < length ; i ++ ) { c = ch [ i ] ; if ( ! isNameChar ( c ) ) { throw new InvalidXMLException ( "The character 0x" + Integer . toHexString ( c ) + " is not valid for the 'Name' production." ) ; } } }
Checks if the specified part of a character array matches the <em>Name</em> production. See:
<a href="http://www.w3.org/TR/REC-xml#NT-Name">Definition of Name</a>.

@param ch     the character array that contains the characters to be checked, cannot be
<code>null</code>.
@param start  the start index into <code>ch</code>, must be &gt;= 0.
@param length the number of characters to take from <code>ch</code>, starting at the
<code>start</code> index.
@throws NullPointerException      if <code>ch == null</code>.
@throws IndexOutOfBoundsException if
<code>start &lt; 0 || start + length &gt; ch.length</code>.
@throws InvalidXMLException       if the specified character string does not match the
<em>Name</em> production.