protected XMLResult getXML(String filePath) throws Exception {
return getXML(getResourceAsStream("/test-documents/" + filePath), new AutoDetectParser(), new Metadata());
}
protected XMLResult getXML(InputStream input, Parser parser, Metadata metadata) throws Exception {
ParseContext context = new ParseContext();
context.set(Parser.class, parser);
try {
ContentHandler handler = new ToXMLContentHandler();
parser.parse(input, handler, metadata, context);
return new XMLResult(handler.toString(), metadata);