public static InputSource getFileReader(String filename) throws FileNotFoundException, IOException {
InputStream is;
if (filename.endsWith(".xml.gz")) {
is = new GZIPInputStream(new FileInputStream(filename));
} else if (filename.endsWith(".xml.bz2")) {
is = new BZip2CompressorInputStream(new FileInputStream(filename));
} else if (filename.endsWith(".xml")) {
is = new FileInputStream(filename);
} else {
System.err.println("Unsupported file: " + filename + ". Supported: *.xml.gz, *.xml.bz2, *.xml");
System.exit(-1);