name = qName;
} else {
name = localName;
}
XPathQName rootQName;
if (namespaceURI == null || namespaceURI.length() == 0) {
rootQName = new XPathQName(name, xmlReader.isNamespaceAware() );
} else {
rootQName = new XPathQName(namespaceURI, name, xmlReader.isNamespaceAware() );
}
xmlDescriptor = xmlContext.getDescriptor(rootQName);
if (null == xmlDescriptor) {
//check for a cached object and look for descriptor by class
Object obj = this.xmlReader.getCurrentObject(session, null);
if (obj != null) {
xmlDescriptor = (XMLDescriptor)xmlContext.getSession(obj.getClass()).getDescriptor(obj.getClass());
}
if(xmlDescriptor == null) {
isPrimitiveType = primitiveWrapperClass != null;
}
}
if (null == xmlDescriptor && !isPrimitiveType) {
if(this.keepAsElementPolicy != UnmarshalKeepAsElementPolicy.KEEP_NONE_AS_ELEMENT) {
this.documentBuilder = new SAXDocumentBuilder();
documentBuilder.startDocument();
//start any prefixes that have already been started
for(String prefix:this.unmarshalNamespaceResolver.getPrefixes()) {
documentBuilder.startPrefixMapping(prefix, this.unmarshalNamespaceResolver.getNamespaceURI(prefix));
}
documentBuilder.startElement(namespaceURI, localName, qName, atts);
this.xmlReader.setContentHandler(documentBuilder);
return;
}
Class unmappedContentHandlerClass = unmarshaller.getUnmappedContentHandlerClass();
if (null == unmappedContentHandlerClass) {
throw XMLMarshalException.noDescriptorWithMatchingRootElement(rootQName.toString());
} else {
UnmappedContentHandler unmappedContentHandler;
try {
PrivilegedNewInstanceFromClass privilegedNewInstanceFromClass = new PrivilegedNewInstanceFromClass(unmappedContentHandlerClass);