public Reader openStream(String publicID,
                            String systemID)
      throws MalformedURLException,
             FileNotFoundException,
             IOException
   {
      URL url = new URL(this.currentReader.systemId, systemID);

      if (url.getRef() != null) {
         String ref = url.getRef();

         if (url.getFile().length() > 0) {
            url = new URL(url.getProtocol(), url.getHost(), url.getPort(),
                          url.getFile());
            url = new URL("jar:" + url + '!' + ref);
         } else {
            url = StdXMLReader.class.getResource(ref);
         }
      }

      this.currentReader.publicId = publicID;
      this.currentReader.systemId = url;
      StringBuffer charsRead = new StringBuffer();
      Reader reader = this.stream2reader(url.openStream(), charsRead);

      if (charsRead.length() == 0) {
         return reader;
      }

      String charsReadStr = charsRead.toString();
      PushbackReader pbreader = new PushbackReader(reader,
                                                   charsReadStr.length());

      for (int i = charsReadStr.length() - 1; i >= 0; i--) {
         pbreader.unread(charsReadStr.charAt(i));
      }

      return pbreader;
   }