开发者

JAXB :: Validation of XML during Unmarshalling

JAXB Generated classes only capture the structural information from the XML schema that is used to generate the classes, but they ignore any additional constraints on the data e.g allowed set of values(enumerations), max value allowed etc. Does it mean that if i do not have a schema i c开发者_运维问答an only validate structural information and not the constraints on the data? If so why was this not allowed with JAXB, annotations could have very well also caputred the constraints?

Best Regards,

Keshav


This is not part of the JAXB 2 specification. If you have an XML schema you can set it on the Unmarshaller to enable validation. You can add bean validation JSR 303 annotations to your model.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜