streamWriter.writeStartDocument();
element.serializeAndConsume(streamWriter);
streamWriter.writeEndDocument();
// now let's read the binary file in to Axiom
XMLStreamReader streamReader = new StAXDocumentParser(new FileInputStream(tempFile));
StAXBuilder builder = new StAXOMBuilder(streamReader);
builder.getDocumentElement().serialize(new FileWriter(outputFile));
// let's see this is the same that we fed in to this test initially
assertXMLEqual(new FileReader(inputFile), new FileReader(outputFile));