background image

Restrictions for External Binding Customizations

<< External Binding Customization Files | Scope, Inheritance, and Precedence >>
<< External Binding Customization Files | Scope, Inheritance, and Precedence >>
C
USTOMIZATION
O
VERVIEW
39
You can have a single binding file that contains customizations for multiple sche-
mas, or you can break the customizations into multiple bindings files; for exam-
ple:
xjc schema1.xsd schema2.xsd schema3.xsd -b bindings123.xjb
xjc schema1.xsd schema2.xsd schema3.xsd -b bindings1.xjb -b
bindings2.xjb -b bindings3.xjb
Note that the ordering of schema files and binding files on the command line
does not matter, although each binding customization file must be preceded by
its own
-b
switch on the command line.
For more information about
xjc
compiler options in general, see JAXB Com-
piler Options (page 16).
Restrictions for External Binding Customizations
There are several rules that apply to binding declarations made in an external
binding customization file that do not apply to similar declarations made inline
in a source schema:
· The binding customization file must begin with the
jxb:bindings
version
attribute, plus attributes for the JAXB and XMLSchema
namespaces:
<jxb:bindings version="1.0"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
· The remote schema to which the binding declaration applies must be iden-
tified explicitly in XPath notation by means of a
jxb:bindings
declaration
specifying
schemaLocation
and
node
attributes:
·
schemaLocation
­ URI reference to the remote schema
·
node
­ XPath 1.0 expression that identifies the schema node within
schemaLocation
to which the given binding declaration is associated;
in the case of the initial
jxb:bindings
declaration in the binding cus-
tomization file, this node is typically
"/xs:schema"
For information about XPath syntax, see XML Path Language, James
Clark and Steve DeRose, eds., W3C, 16 November 1999. Available at
http://www.w3.org/TR/1999/REC-xpath-19991116
.
· Similarly, individual nodes within the schema to which customizations are
to be applied must be specified using XPath notation; for example: