use of org.codehaus.jettison.AbstractXMLStreamWriter in project entando-core by entando.
the class ApsJSONUtils method createStreamWriter.
public static XMLStreamWriter createStreamWriter(OutputStream os, QName qname, boolean writeXsiType, Configuration config, boolean serializeAsArray, List<String> arrayKeys, boolean dropRootElement, String enc) throws Exception {
MappedNamespaceConvention convention = new MappedNamespaceConvention(config);
AbstractXMLStreamWriter xsw = new CDataMappedXMLStreamWriter(convention, new OutputStreamWriter(os, enc));
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;
return writer;
}
use of org.codehaus.jettison.AbstractXMLStreamWriter in project cxf by apache.
the class JSONUtils method createStreamWriter.
// CHECKSTYLE:OFF
public static XMLStreamWriter createStreamWriter(OutputStream os, QName qname, boolean writeXsiType, Configuration config, boolean serializeAsArray, List<String> arrayKeys, boolean dropRootElement, String enc) throws Exception {
// CHECKSTYLE:ON
MappedNamespaceConvention convention = new MappedNamespaceConvention(config);
AbstractXMLStreamWriter xsw = new MappedXMLStreamWriter(convention, new OutputStreamWriter(os, enc));
if (serializeAsArray) {
if (arrayKeys != null) {
for (String key : arrayKeys) {
xsw.serializeAsArray(key);
}
} else if (qname != null) {
String key = getKey(convention, qname);
xsw.serializeAsArray(key);
}
}
return !writeXsiType || dropRootElement ? new IgnoreContentJettisonWriter(xsw, writeXsiType, dropRootElement) : xsw;
}
Aggregations