class ManifestMerger {

    public File createMergedManifest(File[] manifestFiles, Date creationTime, File productDir, long productSize)
            throws IOException, TransformerException, PDUStitchingException, ParserConfigurationException {
        final Document document = mergeManifests(manifestFiles, creationTime, productDir, productSize);
        final File manifestFile = new File(productDir, "xfdumanifest.xml");
        final TransformerFactory transformerFactory = TransformerFactory.newInstance();
        transformerFactory.setAttribute("indent-number", 2);
        final Transformer transformer = transformerFactory.newTransformer();
        transformer.setOutputProperty(OutputKeys.INDENT, "yes");
        transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
        transformer.setOutputProperty(OutputKeys.STANDALONE, "no");
        transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
        final DOMSource domSource = new DOMSource(document);
        final StringWriter stringWriter = new StringWriter();
        final StreamResult streamResult = new StreamResult(stringWriter);
        transformer.transform(domSource, streamResult);
        String docAsString = stringWriter.toString();
        docAsString = docAsString.replace(" standalone=\"no\"", "");
        final FileWriter fileWriter = new FileWriter(manifestFile);
        fileWriter.write(docAsString);
        fileWriter.close();
        return manifestFile;
    }

}