}
private Object buildObjectValuesFromDOMRecord(DOMRecord record, AbstractSession session, ObjectBuildingQuery query) {
//This DOMRecord represents the root node of the AnyType instance
//Grab ALL children to populate the collection.
DirectMapContainerPolicy cp = (DirectMapContainerPolicy) getContainerPolicy();
Object container = null;
if (reuseContainer) {
Object currentObject = record.getCurrentObject();
Object value = getAttributeAccessor().getAttributeValueFromObject(currentObject);
container = value != null ? value : cp.containerInstance();
} else {
container = cp.containerInstance();
}
org.w3c.dom.Element root = (Element) record.getDOM();
NamedNodeMap attributes = root.getAttributes();
Attr next;
String localName;
int numberOfAtts = attributes.getLength();
for (int i = 0; i < numberOfAtts; i++) {
next = (Attr) attributes.item(i);
localName = next.getLocalName();
if (null == localName) {
localName = next.getName();
}
String namespaceURI = next.getNamespaceURI();
boolean includeAttribute = true;
if (!isNamespaceDeclarationIncluded && XMLConstants.XMLNS_URL.equals(namespaceURI)){
includeAttribute = false;
} else if (!isSchemaInstanceIncluded && XMLConstants.SCHEMA_INSTANCE_URL.equals(namespaceURI)){
includeAttribute = false;
}
if (includeAttribute){
String value = next.getValue();
QName key = new QName(namespaceURI, localName);
cp.addInto(key, value, container, session);
}
}
return container;
}