if (obj == null) {
if (optional) { // minOccurs = 0
return;
}
if (aegisType.isNillable() && aegisType.isWriteOuter()) {
ElementWriter writer = new ElementWriter(output);
MessageWriter w2 = writer.getElementWriter(elementName);
w2.writeXsiNil();
w2.close();
return;
}
}
ElementWriter writer = new ElementWriter(output);
MessageWriter w2 = writer.getElementWriter(elementName);
if (getContext().isWriteXsiTypes()
&& aegisType.getSchemaType() != null) {
// if we know the type, write it. We are standalone, and the reader needs it.
w2.writeXsiType(aegisType.getSchemaType());
}