protected InputSource resolveClasspathName ( String systemId , boolean trace ) { if ( systemId == null ) return null ; if ( trace ) log . trace ( "resolveClasspathName, systemId=" + systemId ) ; String filename = systemId ; // Parse the systemId as a uri to get the final path component try { URI url = new URI ( systemId ) ; String path = url . getPath ( ) ; if ( path == null ) path = url . getSchemeSpecificPart ( ) ; int slash = path . lastIndexOf ( ' ' ) ; if ( slash >= 0 ) filename = path . substring ( slash + 1 ) ; else filename = path ; if ( filename . length ( ) == 0 ) return null ; if ( trace ) log . trace ( "Mapped systemId to filename: " + filename ) ; } catch ( URISyntaxException e ) { if ( trace ) log . trace ( "systemId: is not a URI, using systemId as resource" , e ) ; } // Resolve the filename as a classpath resource InputStream is = loadClasspathResource ( filename , trace ) ; InputSource inputSource = null ; if ( is != null ) { inputSource = new InputSource ( is ) ; inputSource . setSystemId ( systemId ) ; } return inputSource ; }
Resolve the systemId as a classpath resource . If not found the systemId is simply used as a classpath resource name .