boolean serializeAsArray,
List<String> arrayKeys,
boolean dropRootElement) throws Exception {
MappedNamespaceConvention convention = new MappedNamespaceConvention(config);
AbstractXMLStreamWriter xsw = new MappedXMLStreamWriter(
convention,
new OutputStreamWriter(os, UTF8));
if (serializeAsArray) {
if (arrayKeys != null) {
for (String key : arrayKeys) {
xsw.serializeAsArray(key);
}
} else if (qname != null) {
String key = getKey(convention, qname);
xsw.serializeAsArray(key);
}
}
XMLStreamWriter writer = !writeXsiType || dropRootElement
? new IgnoreContentJettisonWriter(xsw, writeXsiType, dropRootElement) : xsw;