private String getFilteredText ( String filename , String encoding , boolean xmlFiltering ) throws IOException { if ( options . isVerbose ( ) ) { lt . setOutput ( System . err ) ; } // don't use StringTools.readStream() as that might add newlines which aren't there: try ( InputStreamReader reader = getInputStreamReader ( filename , encoding ) ) { String fileContents = readerToString ( reader ) ; if ( xmlFiltering ) { return filterXML ( fileContents ) ; } else { return fileContents ; } } }
Loads filename and filters out XML . Note that the XML filtering can lead to incorrect positions in the list of matching rules .