SaxUtils { public static String getSystemId(Resource resource) { try { return new URI(resource.getURL().toExternalForm()).toString(); } catch (IOException ex) { logger.debug("Could not get System ID from [" + resource + "], ex"); return null; } catch (URISyntaxException e) { logger.debug("Could not get System ID from [" + resource + "], ex"); return null; } }  static InputSource createInputSource(Resource resource); static String getSystemId(Resource resource);  }
@Test public void testGetSystemId() throws Exception { Resource resource = new FileSystemResource("/path with spaces/file with spaces.txt"); String systemId = SaxUtils.getSystemId(resource); Assert.assertNotNull("No systemId returned", systemId); Assert.assertTrue("Invalid system id", systemId.endsWith("path%20with%20spaces/file%20with%20spaces.txt")); }