}
protected void internalSerialize(XMLStreamWriter writer2, boolean cache)
throws XMLStreamException {
MTOMXMLStreamWriter writer = (MTOMXMLStreamWriter) writer2;
if (!writer.isIgnoreXMLDeclaration()) {
String charSetEncoding = writer.getCharSetEncoding();
String xmlVersion = writer.getXmlVersion();
writer
.getXmlStreamWriter()
.writeStartDocument(
charSetEncoding == null ? OMConstants.DEFAULT_CHAR_SET_ENCODING
: charSetEncoding,
xmlVersion == null ? OMConstants.DEFAULT_XML_VERSION