if (type == null) {
throw new DatabindingException("Couldn't find type for " + value.getClass()
+ " for property " + name);
}
MessageWriter cwriter = writer.getAttributeWriter(name);
type.writeObject(value, cwriter, context);
cwriter.close();
}
}
for (Iterator itr = inf.getElements(); itr.hasNext();) {
QName name = (QName)itr.next();
if (inf.isExtension()
&& inf.getPropertyDescriptorFromMappedName(name).getReadMethod().getDeclaringClass() != inf
.getTypeClass()) {
continue;
}
Object value = readProperty(object, name);
Type defaultType = getType(inf, name);
Type type = TypeUtil.getWriteType(context.getGlobalContext(), value, defaultType);
// Write the value if it is not null.
if (value != null) {
if (type == null) {
throw new DatabindingException("Couldn't find type for " + value.getClass()
+ " for property " + name);
}
writeElement(name, value, type, writer, context);
} else if (inf.isNillable(name)) {
MessageWriter cwriter = getWriter(writer, name, type);
// Write the xsi:nil if it is null.
cwriter.writeXsiNil();
cwriter.close();
}
}
if (inf.isExtension()) {
Type t = getSuperType();
if (t != null) {