@ Override public InputSource resolveEntity ( String publicId , String systemId ) { InputStream inStream = null ; // Check for a match on the systemId if ( systemId != null ) { if ( dtdName != null && systemId . indexOf ( dtdName ) != - 1 ) { inStream = getResourceAsStream ( dtdPath + "/" + dtdName ) ; } else if ( systemId . trim ( ) . equalsIgnoreCase ( "http://my.netscape.com/publish/formats/rss-0.91.dtd" ) ) { inStream = getResourceAsStream ( dtdPath + "/rss-0.91.dtd" ) ; } if ( null != inStream ) { return new InputSource ( inStream ) ; } } // Check for a match on the public id if ( publicId != null ) { publicId = publicId . trim ( ) ; for ( int i = 0 ; i < publicIds . length ; i ++ ) { if ( publicId . equalsIgnoreCase ( publicIds [ i ] . publicId ) ) { inStream = getResourceAsStream ( publicIds [ i ] . dtdFile ) ; if ( null != inStream ) { return new InputSource ( inStream ) ; } break ; } } } // Return null to let the parser handle this entity return null ; }
Sets up a new input source based on the dtd specified in the xml document