background image

Simple Type Definitions

<< More about Unmarshalling | Java-to-Schema Mapping >>
<< More about Unmarshalling | Java-to-Schema Mapping >>

Simple Type Definitions

Binding XML Schemas
This section describes the default XML-to-Java bindings used by JAXB. All of these bindings
can be overridden on global or case-by-case levels by means of a custom binding declaration.
See the
JAXB Specification (http://java.sun.com/xml/downloads/jaxb.html)
for complete
information about the default JAXB bindings.
Simple Type Definitions
A schema component using a simple type definition typically binds to a Java property. Since
there are different kinds of such schema components, the following Java property attributes
(common to the schema components) include:
Base type
Collection type, if any
Predicate
The rest of the Java property attributes are specified in the schema component using the simple
type definition.
Default Data Type Bindings
The following sections explain the default schema-to-Java, JAXBElement, and Java-to-schema
data type bindings.
Schema-to-Java Mapping
The Java language provides a richer set of data type than XML schema.
Table 17­1
lists the
mapping of XML data types to Java data types in JAXB.
TABLE 17­1
JAXB Mapping of XML Schema Built-in Data Types
XML Schema Type
Java Data Type
xsd:string
java.lang.String
xsd:integer
java.math.BigInteger
xsd:int
int
xsd.long
long
xsd:short
short
xsd:decimal
java.math.BigDecimal
Binding XML Schemas
Chapter 17 · Binding between XML Schema and Java Classes
493