// get the id of the target object
String id = null;
try {
ClassDescriptorResolver classDescriptorResolver = context.getClassDescriptorResolver();
ClassDescriptor classDescriptor = classDescriptorResolver.resolve(object.getClass());
FieldDescriptor fieldDescriptor = classDescriptor.getIdentity();
FieldHandler fieldHandler = fieldDescriptor.getHandler();
id = (String) fieldHandler.getValue(object);
} catch (Exception e) {
String err = "The object associated with IDREF \"" + object