Object object, Session session, NamespaceResolver namespaceResolver) {
// Handle attributes - XSI_NIL, ABSENT_NODE have the same behavior
if (xPathFragment.isAttribute()) {
// Write out an empty attribute
if (getMarshalNullRepresentation().equals(XMLNullRepresentationType.EMPTY_NODE)) {
XPathFragment groupingFragment = marshalRecord.openStartGroupingElements(namespaceResolver);
// We mutate the null into an empty string
marshalRecord.attribute(xPathFragment, namespaceResolver, EMPTY_STRING);
marshalRecord.closeStartGroupingElements(groupingFragment);
return true;
} else {
// XSI_NIL attributes are invalid - and are ignored
// ABSENT_NODE - Write out nothing
return false;
}
} else {
// Nillable: write out xsi:nil="true" attribute in empty element
if (getMarshalNullRepresentation().equals(XMLNullRepresentationType.XSI_NIL)) {
String xsiPrefix = processNamespaceResolverForXSIPrefix(namespaceResolver);
StringBuilder qName = new StringBuilder('@'); // Unsynchronized
qName.append(xsiPrefix).append(COLON_W_SCHEMA_NIL_ATTRIBUTE);
XPathFragment nilFragment = new XPathFragment(qName.toString());
XPathFragment groupingFragment = marshalRecord.openStartGroupingElements(namespaceResolver);
marshalRecord.attribute(nilFragment, namespaceResolver, TRUE);
marshalRecord.closeStartGroupingElements(groupingFragment);
return true;
} else {
// EMPTY_NODE - Write out empty element
if (getMarshalNullRepresentation().equals(XMLNullRepresentationType.EMPTY_NODE)) {
XPathFragment groupingFragment = marshalRecord.openStartGroupingElements(namespaceResolver);
marshalRecord.closeStartGroupingElements(groupingFragment);
return true;
} else {
// ABSENT_NODE - Write out nothing
return false;