private void checkEncodingMatch(String used, String detected)
            throws SAXException {
        // method added -- 2006-02-03 hsivonen
        if (used == null) {
            if (!characterEncoding.equalsIgnoreCase(detected)) {
                fatal(
                        "Declared character encoding was not the one sniffed from the BOM.",
                        detected, characterEncoding);
            }
        } else {
            if (!"".equals(used) && !used.equalsIgnoreCase(detected)) {
                handler.warn("External encoding information specified "
                        + used
                        + ", but XML declaration specified "
                        + detected
                        + ". Allowing external to override per RFC 3023. The well-formedness status of this document may change when decoupled from the external character encoding information.");
            }
        }
    }
Parse a text declaration.

<pre>
 [79] TextDecl ::= '&lt;?xml' VersionInfo? EncodingDecl S? '?&gt;'
 [80] EncodingDecl ::= S 'encoding' Eq
    ( '&quot;' EncName '&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 #parseXMLDecl
@see #setupDecoding
src/nu/validator/gnu/xml/aelfred2/XmlParser.java