final XMLClassDescriptor classDesc,
Object parent) throws SAXException {
//Object value = attValue;
while (descriptor.isContainer()) {
FieldHandler handler = descriptor.getHandler();
Object containerObject = handler.getValue(parent);
if (containerObject == null) {
containerObject = handler.newInstance(parent);
handler.setValue(parent, containerObject);
}
ClassDescriptor containerClassDesc =
((XMLFieldDescriptorImpl) descriptor).getClassDescriptor();
descriptor = ((XMLClassDescriptor) containerClassDesc).getFieldDescriptor(
attName, attNamespace, NodeType.Attribute);
parent = containerObject;
}
if (attValue == null) {
//-- Since many attributes represent primitive
//-- fields, we add an extra validation check here
//-- in case the class doesn't have a "has-method".
if (descriptor.isRequired() && isValidating()) {
String err = classDesc.getXMLName() + " is missing "
+ "required attribute: " + attName;
if (_locator != null) {
err += "\n - line: " + _locator.getLineNumber()
+ " column: " + _locator.getColumnNumber();
}
throw new SAXException(err);
}
return;
}
//-- if this is the identity then save id
if (classDesc.getIdentity() == descriptor) {
try {
_idResolver.bind(attValue, parent,
isValidating() && !getInternalContext().getLenientIdValidation());
} catch (ValidationException e) {
throw new SAXException("Duplicate ID " + attValue + " encountered.", e);
}
//-- save key in current state
UnmarshalState state = (UnmarshalState) _stateInfo.peek();
state.key = attValue;
//-- resolve waiting references
resolveReferences(attValue, parent);
} else if (descriptor.isReference()) {
//-- if this is an IDREF(S) then resolve reference(s)
if (descriptor.isMultivalued()) {
StringTokenizer st = new StringTokenizer(attValue);
while (st.hasMoreTokens()) {
processIDREF(st.nextToken(), descriptor, parent);
}
} else {
processIDREF(attValue, descriptor, parent);
}
//-- object values have been set by processIDREF
//-- simply return
return;
}
//-- if it's a constructor argument, we can exit at this point
//-- since constructor arguments have already been set
if (descriptor.isConstructorArgument()) {
return;
}
//-- attribute handler
FieldHandler handler = descriptor.getHandler();
if (handler == null) {
return;
}
//-- attribute field type