List<TypeReference> typeRefs = new ArrayList<TypeReference>();
typeRefs.add(ref);
List<Class<?>> clses = new ArrayList<Class<?>>(ctxClasses);
clses.add(ref.type.getClass());
try {
JAXBRIContext riContext = JAXBRIContext.newInstance(clses.toArray(new Class[clses.size()]),
typeRefs, null, null, true, null);
Bridge bridge = riContext.createBridge(ref);
if (source instanceof XMLStreamReader) {
//DOMUtils.writeXml(StaxUtils.read((XMLStreamReader)source), System.out);
return bridge.unmarshal((XMLStreamReader)source);
} else if (source instanceof InputStream) {