code: public static URL urlFromSystemId(String sysId) throws IOException
      {
          try {
  	    sysId = cleanSystemId(sysId);
              /* Ok, does it look like a full URL? For one, you need a colon. Also,
               * to reduce likelihood of collision with Windows paths, let's only
               * accept it if there are 3 preceding other chars...
               * Not sure if Mac might be a problem? (it uses ':' as file path
               * separator, alas, at least prior to MacOS X)
               */
              int ix = sysId.indexOf(':', 0);
              /* Also, protocols are generally fairly short, usually 3 or 4
               * chars (http, ftp, urn); so let's put upper limit of 8 chars too
               */
              if (ix >= 3 && ix <= 8) {
                  return new URL(sysId);
              }
              // Ok, let's just assume it's local file reference...
              /* 24-May-2006, TSa: Amazingly, this single call does show in
               *   profiling, for small docs. The problem is that deep down it
               *   tries to check physical file system, to check if the File
               *   pointed to is a directory: and that is (relatively speaking)
               *   a very expensive call. Since in this particular case it
               *   should never be a dir (and/or doesn't matter), let's just
               *   implement conversion locally
               */
              String absPath = new java.io.File(sysId).getAbsolutePath();
              // Need to convert colons/backslashes to regular slashes?
              {
                  char sep = File.separatorChar;
                  if (sep != '/') {
                      absPath = absPath.replace(sep, '/');
                  }
              }
              if (absPath.length() > 0 && absPath.charAt(0) != '/') {
                  absPath = "/" + absPath;
              }
              return new URL("file", "", absPath);
          } catch (MalformedURLException e) {
              throwIOException(e, sysId);
              return null; // never gets here
          }
      }
docs: Method that tries to figure out how to create valid URL from a system
  id, without additional contextual information.
  If we could use URIs this might be easier to do, but they are part
  of JDK 1.4, and preferably code should only require 1.2 (or maybe 1.3)