if (part.getXmlSchema() instanceof XmlSchemaElement
&& ((XmlSchemaElement)part.getXmlSchema()).getMinOccurs() == 0) {
//skip writing minOccurs=0 stuff if obj is null
return;
} else if (type.isNillable() && type.isWriteOuter()) {
ElementWriter writer = new ElementWriter(output);
MessageWriter w2 = writer.getElementWriter(part.getConcreteName());
w2.writeXsiNil();
w2.close();
return;
}
}
ElementWriter writer = new ElementWriter(output);
MessageWriter w2 = writer.getElementWriter(part != null ? part.getConcreteName()
: type.getSchemaType());
type.writeObject(obj, w2, context);
w2.close();
} catch (DatabindingException e) {
throw new RuntimeException(e);