XMLStreamWriter spyingWriter = new PrefixCollectingXMLStreamWriter(w3cStreamWriter,
namespaceMap);
spyingWriter.writeStartDocument();
// use type qname as element qname?
aegisWriter.write(obj, aegisType.getSchemaType(), false, spyingWriter, aegisType);
spyingWriter.writeEndDocument();
spyingWriter.close();
Document dom = w3cStreamWriter.getDocument();
// ok, now the namespace map has all the prefixes.
String enc = HttpUtils.getSetEncoding(m, headers, "UTF-8");