String type = element.getAttribute("xsi:type");
if (type != null && type.endsWith(":" + xmlElementName)) {
// OK
} else {
throw new OpsException("Incorrect element type: " + xmlElementName + " vs " + nodeName);
}
}
T object = jaxbHelper.unmarshal(element, itemClass);
if (!(object.getClass().isAssignableFrom(itemClass))) {
System.out.println("XML = " + ((UntypedItemXml) untypedItem).serialize());
}
typedItem = Casts.checkedCast(object, itemClass);
} catch (JAXBException e) {
throw new OpsException("Error deserializing item", e);
}
return typedItem;
}