specify minOccurence and maxOccurence with jaxb annotations
How do I specify minOccurence and maxOccurence for the collection(lis开发者_运维百科t) in .java file with jaxb annotations?
You can't. JAXB annotations have only a very minimal set of validation abilities.
If you need to perform validation at runtime, you need to use an XML Schema for this. If you need to generate an XML Schema from Java, then you need to alter it after you generate it, to add the various bits of tight validation that you need.
精彩评论