for (int i = 0; i < inputs.length; i++) {
File input = new File(tests, inputs[i]);
Document doc = builder.build(input);
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
Canonicalizer serializer = new Canonicalizer(
out, Canonicalizer.CANONICAL_XML_WITH_COMMENTS);
serializer.write(doc);
}
finally {
out.close();
}
byte[] actual = out.toByteArray();