When to Use Custom Declarations

In certain situations, developers find it appropriate to override the default bindings by using the custom declarations. Some examples of such use cases are:

Automatically creating Javadoc style documentation in the generated code. By using the javadoc annotation in the schema, developers can include descriptive information in the Java code emitted by the binding compiler.

Providing application-specific Java identifiers. For example:

Developers may sometimes need to specify a particular package name for the generated code rather than using the default package name, which maps to the namespace.

XML schemas may sometime contain elements that conflict with Java language keywords or identifiers, causing "collisions." The binding compiler will detect such collisions, throw a fatal error, and exit. Custom bindings can be used to rectify such errors.

Override the default bindings used by the schema compiler for application-specific behavior or optimization. For example, it may be useful to map constants in the schema to a public static final String rather than a String .