// try and get a Unit Of Work from the XMLContext
session = xmlContext.getReadSession(clazz);
xmlDescriptor = (XMLDescriptor) session.getDescriptor(clazz);
unmarshalRecord = (UnmarshalRecord) xmlDescriptor.getObjectBuilder().createRecord(session);
}
XMLReader extendedXMLReader;
if(xmlReader instanceof XMLReader) {
extendedXMLReader = (XMLReader) xmlReader;
} else {
extendedXMLReader = new XMLReader(xmlReader);
}
unmarshalRecord.setXMLReader(extendedXMLReader);
unmarshalRecord.setUnmarshaller(xmlUnmarshaller);
extendedXMLReader.setContentHandler(unmarshalRecord);
try {
extendedXMLReader.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.
}
extendedXMLReader.parse(inputSource);
// resolve mapping references
xmlUnmarshaller.resolveReferences(session);
if (isPrimitiveWrapper || clazz == ClassConstants.OBJECT) {