private void checkEncodingLiteral(String encodingName) throws SAXException {
        if (encodingName == null) {
            return;
        }
        if (encodingName.length() == 0) {
            fatal("The empty string does not a legal encoding name.");
        }
        char c = encodingName.charAt(0);
        if (!(((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')))) {
            fatal("The encoding name must start with an ASCII letter.");
        }
        for (int i = 1; i < encodingName.length(); i++) {
            c = encodingName.charAt(i);
            if (!(((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z'))
                    || ((c >= '0') && (c <= '9')) || (c == '.') || (c == '_') || (c == '-'))) {
                fatal("Illegal character in encoding name: U+"
                        + Integer.toHexString(c) + ".");
            }
        }
    }
Parse the XML declaration.

<pre>
 [23] XMLDecl ::= '&lt;?xml' VersionInfo EncodingDecl? SDDecl? S? '?&gt;'
 [24] VersionInfo ::= S 'version' Eq
    (&quot;'&quot; VersionNum &quot;'&quot; | '&quot;' VersionNum '&quot;' )
 [26] VersionNum ::= ([a-zA-Z0-9_.:] | '-')*
 [32] SDDecl ::= S 'standalone' Eq
    ( &quot;'&quot;&quot; ('yes' | 'no') &quot;'&quot;&quot; | '&quot;' (&quot;yes&quot; | &quot;no&quot;) '&quot;' )
 [80] EncodingDecl ::= S 'encoding' Eq
    ( &quot;'&quot; EncName &quot;'&quot; | &quot;'&quot; EncName &quot;'&quot; )
 [81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*
</pre>

<p>
(The <code>&lt;?xml</code> and whitespace have already been read.)

@return the encoding in the declaration, uppercased; or null
@see #parseTextDecl
@see #setupDecoding
src/nu/validator/gnu/xml/aelfred2/XmlParser.java