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 type = getType(inf, name);
type = TypeUtil.getWriteType(context, value, type);
MessageWriter cwriter;
// Write the value if it is not null.
if (value != null) {
cwriter = getWriter(writer, name, type);
if (type == null) {
throw new DatabindingException("Couldn't find type for " + value.getClass()
+ " for property " + name);
}
type.writeObject(value, cwriter, context);
cwriter.close();
} else if (inf.isNillable(name)) {
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) {