  public Document read(File file) throws DocumentException {
    try {
      /*
       * We cannot convert the file to an URL because if the filename
       * contains '#' characters, there will be problems with the URL in
       * the InputSource (because a URL like
       * http://myhost.com/index#anchor is treated the same as
       * http://myhost.com/index) Thanks to Christian Oetterli
       */
      InputSource source = new InputSource(new FileInputStream(file));
      if (this.encoding != null) {
        source.setEncoding(this.encoding);
      }
      String path = file.getAbsolutePath();

      if (path != null) {
        // Code taken from Ant FileUtils
        StringBuffer sb = new StringBuffer("file://");

        // add an extra slash for filesystems with drive-specifiers
        if (!path.startsWith(File.separator)) {
          sb.append("/");
        }

        path = path.replace('\\', '/');
        sb.append(path);

        source.setSystemId(sb.toString());
      }

      return read(source);
    } catch (FileNotFoundException e) {
      throw new DocumentException(e.getMessage(), e);
    }
  }
The software processes an XML document that can contain XML entities with URIs that resolve to documents outside of the intended sphere of control, causing the product to embed incorrect documents into its output.