public JAXBElement unmarshal(XMLStreamReader streamReader, Class javaClass) throws JAXBException {
Class classToUnmarshalTo = getClassToUnmarshalTo(javaClass);
XMLStreamReaderReader staxReader = new XMLStreamReaderReader();
staxReader.setErrorHandler(xmlUnmarshaller.getErrorHandler());
XMLStreamReaderInputSource inputSource = new XMLStreamReaderInputSource(streamReader);
JAXBElement unmarshalled = buildJAXBElementFromObject(xmlUnmarshaller.unmarshal(staxReader, inputSource, classToUnmarshalTo), javaClass);
if(classToUnmarshalTo != javaClass){
JAXBElement returnVal = new JAXBElement(unmarshalled.getName(), javaClass, unmarshalled.getScope(), unmarshalled.getValue());
return returnVal;