We are using JiBX CodeGen to go from XML schema to Java for Axis2 web services. We code our XSD files with the appropriate constraints on each field. However, we are doing all of our request validation on the server side in Java. We want our validation logic to be executed in the business tier so we can provide precise, contextual, localized error coding and error messages on the response. For this we are using the Spring Validator framework, which really simplifies the task.
One problem with this approach is that we have to code the constraints twice, once in the XSD and once in Java. This means that we also have to keep them in sync, which is hard. Now that Spring supports JSR-303, we could eliminate the Java coding of basic validation by using annotations on our entity classes (example below). If these could be derived from our XML schema, it would be great! I know that there has been some discussion about JiBX and JSR-303, but nothing recently. Has any progress been made on this? Has anyone come up with a solution? Is there any way to generate an import and an annotation via CodeGen? JSR-303 EXAMPLE: import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; public class Car { @NotNull private String manufacturer; @NotNull @Size(min = 2, max = 14) private String licensePlate; public Car(String manufacturer, String licencePlate) { super(); this.manufacturer = manufacturer; this.licensePlate = licencePlate; } //getters and setters ... } -- View this message in context: http://old.nabble.com/Anyone-have-a-solution-for-JSR-303-validation--tp30564412p30564412.html Sent from the jibx-users mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users