byte[] data = new byte[10];
File file = File.createTempFile("base64", "xml");
FileOutputStream fos = new FileOutputStream(file);
ElementWriter writer = new ElementWriter(fos, "root", "urn:test");
MessageWriter b64writer = writer.getElementWriter("base64", "urn:test");
type.writeObject(data,
b64writer,
new MessageContext());
b64writer.close();
b64writer = writer.getElementWriter("base64", "urn:test");
type.writeObject(data,
b64writer,
new MessageContext());
b64writer.close();
writer.close();
writer.flush();
fos.close();
FileInputStream fis = new FileInputStream(file);
XMLStreamReader reader = STAXUtils.createXMLStreamReader(fis, null,null);
reader.next();