我无法在网上找到任何解释如何在解组阶段针对现有XSD架构验证XML的示例。
目前我的工作正常:
IBindingFactory bfact = BindingDirectory
.getFactory(aClass.class);
IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
return (aClass) uctx.unmarshalDocument(new FileInputStream(
fname), null);
} catch (FileNotFoundException e) {
throw new IOException(e);
} catch (JiBXException e) {
throw new IOException(e);
}
但是在这个过程中我可以告诉Jibx在解组到对象之前根据模式验证XML吗?是否可以使用JiBX?我看到使用JaxB但没有使用JibX的示例。