Validating xml java
This work is being conducted as part of JSR 303 under the Java Community Process Program.
This specification is the result of the collaborative work of the members of the JSR 303 Expert Group.
* * @author Emmanuel Bernard * @author Gavin King * @author Hardy Ferentschik */ @Documented @Target() @Retention(RUNTIME) public @interface Constraint to allow Bean Validation provider specific extensions.
It is considered good practice to follow the same approach for custom annotations.
HTML browsers are allowed to display HTML documents with errors (like missing end tags). A "well formed" XML document is not the same as a "valid" XML document. In addition, it must conform to a document type definition.
To avoid duplication of these validations in each layer, developers often bundle validation logic directly into the domain model, cluttering domain classes with validation code that is, in fact, metadata about the class itself.
This JSR defines a metadata model and API for Java Bean validation.
Since a given constraint definition applies to one or more specific Java types, the Java Doc for the constraint annotation should clearly state which types are supported.
Applying a constraint annotation to an incompatible type will raise an values to resource bundle keys to enable internationalization.
The default metadata source is annotations, with the ability to override and extend the meta-data through the use of XML validation descriptors.