@Test public void testGeneratedFiles() throws SAXException, IOException { final File[] files = { new File("maps", "root-map-01.ditamap"), new File("topics", "target-topic-a.xml"), new File("topics", "target-topic-c.xml"), new File("topics", "xreffin-topic-1.xml"), new File("topics", "copy-to.xml"), }; final Map<File, File> copyto = new HashMap<File, File>(); copyto.put(new File("topics", "copy-to.xml"), new File("topics", "xreffin-topic-1.xml")); final TestHandler handler = new TestHandler(); final XMLReader parser = XMLReaderFactory.createXMLReader(); parser.setContentHandler(handler); for (final File f : files) { InputStream in = null; try { in = new FileInputStream(new File(tmpDir, f.getPath())); handler.setSource( new File(inputDir, copyto.containsKey(f) ? copyto.get(f).getPath() : f.getPath())); parser.parse(new InputSource(in)); } finally { if (in != null) { in.close(); } } } }