How do I specify a pattern constraint using JAXB annotations?

孤人 提交于 2019-12-12 17:17:40

问题


I'm developing a SOAP application using JAX-WS and JAXB. I'd like to specify a pattern constraint for one of the fields (a Dutch postcode, \d{4}[A-Z]{2}). That's very easy to do using xsd:pattern, but I can't find the equivalent JAXB annotation. How do I achieve this?


回答1:


You can't. The idea is to use JAXB annotations in combination with runtime validation against the schema, using javax.xml.validation.Schema, which can be plugged into the Marshaller and Unmarshaller.



来源:https://stackoverflow.com/questions/6625094/how-do-i-specify-a-pattern-constraint-using-jaxb-annotations

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!