code: public void setEntityBaseUrl(final URL base) {
          reader.setEntityResolver(new EntityResolver() {
              public InputSource resolveEntity(final String publicId, final String systemId) throws IOException {
                  return new InputSource(new URL(base, systemId).openStream());
              }
          });
      }
docs: Resolves entities against using the supplied URL as the base for relative URLs
  
  @param base The URL used to resolve relative URLs