code: private String tryEncodingDecl(String encoding) throws SAXException,
              IOException {
          // Read the XML/text declaration.
          if (tryRead("<?xml")) {
              if (tryWhitespace()) {
                  if (inputStack.size() > 0) {
                      return parseTextDecl(encoding);
                  } else {
                      return parseXMLDecl(encoding);
                  }
              } else {
                  // <?xml-stylesheet ...?> or similar
                  pushString(null, "<?xml");
  //                unread('l');
  //                unread('m');
  //                unread('x');
  //                unread('?');
  //                unread('<');
              }
          }
          // 2006-02-03 hsivonen
          warnAboutLackOfEncodingDecl(encoding);
          return null;
      }
docs: Check for an encoding declaration. This is the second part of the XML
  encoding autodetection algorithm, relying on detectEncoding to get to the
  point that this part can read any encoding declaration in the document
  (using only US-ASCII characters).
  
  <p>
  Because this part starts to fill parser buffers with this data, it's
  tricky to setup a reader so that Java's built-in decoders can be used for
  the character encodings that aren't built in to this parser (such as
  EUC-JP, KOI8-R, Big5, etc).
  
  @return any encoding in the declaration, uppercased; or null
  @see detectEncoding