return null;
}
final org.eclipse.persistence.jaxb.JAXBContext moxyJaxbContext = JAXBHelper.getJAXBContext(jaxbContext);
final XMLContext xmlContext = moxyJaxbContext.getXMLContext();
final DatabaseSession session = xmlContext.getSession(0);
Class<?> expectedType = this.expectedType;
if (!isRoot) {
final HashMap<Type, QName> typeToSchemaType = moxyJaxbContext.getTypeToSchemaType();
for (Map.Entry<Type, QName> entry : typeToSchemaType.entrySet()) {
if (entry.getValue().getLocalPart().equals(elementName.getLocalPart())) {
expectedType = (Class<?>) entry.getKey();
break;
}
}
}
if (JAXBElement.class.isAssignableFrom(expectedType)) {
final Map<Class, ClassDescriptor> descriptors = session.getDescriptors();
for (Map.Entry<Class, ClassDescriptor> descriptor : descriptors.entrySet()) {
final QName defaultRootElementType = ((XMLDescriptor) descriptor.getValue()).getDefaultRootElementType();
// Check local name.
if (defaultRootElementType == null
|| !defaultRootElementType.getLocalPart().contains(elementName.getLocalPart())) {
continue;
}
// Check namespace.
if ((defaultRootElementType.getNamespaceURI() == null && elementName.getNamespaceURI() == null)
|| (defaultRootElementType.getNamespaceURI() != null
&& defaultRootElementType.getNamespaceURI().equals(elementName.getNamespaceURI()))) {
expectedType = descriptor.getKey();
}
}
}
final ClassDescriptor descriptor = session.getDescriptor(expectedType);
if (descriptor != null) {
final TreeObjectBuilder objectBuilder = (TreeObjectBuilder) descriptor.getObjectBuilder();
return new XPathNodeWrapper(objectBuilder.getRootXPathNode(),