{"size": 1047, "ext": "js", "max_stars_repo_path": "remove-prefix-uri-resolver/wsAccess.js", "max_stars_repo_name": "oxygenxml/web-author-sample-plugins", "max_stars_repo_stars_event_min_datetime": "2021-05-02T17:12:32.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-08T17:05:21.000Z", "max_issues_repo_path": "remove-prefix-uri-resolver/wsAccess.js", "max_issues_repo_name": "oxygenxml/web-author-sample-plugins", "max_issues_repo_issues_event_min_datetime": "2019-10-29T13:17:13.000Z", "max_issues_repo_issues_event_max_datetime": "2019-10-29T14:29:15.000Z", "max_forks_repo_path": "remove-prefix-uri-resolver/wsAccess.js", "max_forks_repo_name": "oxygenxml/web-author-sample-plugins", "max_forks_repo_forks_event_min_datetime": "2022-01-21T15:24:02.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-21T15:24:02.000Z"}
{"max_stars_count": 2, "max_issues_count": 1, "max_forks_count": 1, "avg_line_length": 26.175, "max_line_length": 109, "alphanum_fraction": 0.7010506208}
var URI = Packages.java.net.URI;
var URIResolver = Packages.javax.xml.transform.URIResolver;
var Source = Packages.javax.xml.transform.Source;
var System = Packages.java.lang.System;


var prefix = "/Content/";

function applicationStarted(pluginWorkspaceAccess) {
  var uriResolver = {
    resolve: function (childURL, baseURL) {
      if (childURL && childURL.indexOf(prefix) === 0) {
        childURL = childURL.substring(prefix.length);
        var resolvedURL = defaultResolve(baseURL, childURL);
        return createSource(resolvedURL);
      } else {
        return null;
      }
    }
  }
  pluginWorkspaceAccess.getXMLUtilAccess().addPriorityURIResolver(new JavaAdapter(URIResolver, uriResolver));
}

function defaultResolve(baseURL, childURL) {
  return new URI(baseURL).resolve(childURL).toString();
}

function createSource(systemId) {
  return new JavaAdapter(Source, { 
    getSystemId: function() { 
      return systemId;
    }, 
    setSystemId: function() {
    }
  });
}

function applicationClosing(pluginWorkspaceAccess) {
}
