private void giveToOXToProcess(String namespaceURI, String localName, String qName, Attributes atts, XMLDescriptor xmlDescriptor) throws SAXException {
AbstractSession session = ((SDOXMLHelper)aHelperContext.getXMLHelper()).getXmlContext().getReadSession(xmlDescriptor);
//taken from SAXUnmarshallerHandler start Element
UnmarshalRecord unmarshalRecord;
if (xmlDescriptor.hasInheritance()) {
unmarshalRecord = new UnmarshalRecord((TreeObjectBuilder)xmlDescriptor.getObjectBuilder());
unmarshalRecord.setNamespaceMap(namespaceMap);
unmarshalRecord.setUriToPrefixMap(uriToPrefixMap);
unmarshalRecord.setAttributes(atts);
Class classValue = xmlDescriptor.getInheritancePolicy().classFromRow(unmarshalRecord, session);
if (classValue == null) {
// no xsi:type attribute - look for type indicator on the default root element
QName leafElementType = xmlDescriptor.getDefaultRootElementType();
// if we have a user-set type, try to get the class from the inheritance policy
if (leafElementType != null) {
Object indicator = xmlDescriptor.getInheritancePolicy().getClassIndicatorMapping().get(leafElementType);
// if the inheritance policy does not contain the user-set type, throw an exception
if (indicator == null) {
throw DescriptorException.missingClassForIndicatorFieldValue(leafElementType, xmlDescriptor.getInheritancePolicy().getDescriptor());
}
classValue = (Class)indicator;
}
}
if (classValue != null) {
xmlDescriptor = (XMLDescriptor)session.getDescriptor(classValue);
} else {
// since there is no xsi:type attribute, we'll use the descriptor
// that was retrieved based on the rootQName - we need to make
// sure it is non-abstract
if (Modifier.isAbstract(xmlDescriptor.getJavaClass().getModifiers())) {
// need to throw an exception here
throw DescriptorException.missingClassIndicatorField(unmarshalRecord, xmlDescriptor.getInheritancePolicy().getDescriptor());
}
}
}
unmarshalRecord = (UnmarshalRecord)xmlDescriptor.getObjectBuilder().createRecord(session);
unmarshalRecord.setParentRecord(parentRecord);
unmarshalRecord.setUnmarshaller(parentRecord.getUnmarshaller());
unmarshalRecord.setXMLReader(parentRecord.getXMLReader());
unmarshalRecord.startDocument();
unmarshalRecord.setNamespaceMap(namespaceMap);
unmarshalRecord.setUriToPrefixMap(uriToPrefixMap);
unmarshalRecord.startElement(namespaceURI, localName, qName, atts);
parentRecord.getXMLReader().setContentHandler(unmarshalRecord);
try {
unmarshalRecord.getXMLReader().setProperty("http://xml.org/sax/properties/lexical-handler", unmarshalRecord);
} catch (SAXNotRecognizedException ex) {
} catch (SAXNotSupportedException ex) {
//if lexical handling is not supported by this parser, just ignore.
}
currentDataObjects.push(unmarshalRecord.getCurrentObject());
depth++;
}