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.
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 schema component using simple type definition.
Default Data Type Bindings
The Java language provides a richer set of data type than XML schema.
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 |
xsd:float | float |
xsd:double | double |
xsd:boolean | boolean |
xsd:byte | byte |
xsd:QName | javax.xml.namespace.QName |
xsd:dateTime | java.util.Calendar |
xsd:base64Binary | byte[] |
xsd:hexBinary | byte[] |
xsd:unsignedInt | long |
xsd:unsignedShort | int |
xsd:unsignedByte | short |
xsd:time | java.util.Calendar |
xsd:date | java.util.Calendar |
xsd:anySimpleType | java.lang.String |
Default Binding Rules
The JAXB binding model follows the default binding rules summarized below:
From | To |
XML Namespace URI | Java package |
Named complex type | Java content interface |
Anonymous inlined type definition of an element declaration | Java content interface |
A named simple type definition with a basetype that derives from "xsd:NCName" and has enumeration facet | enum class |
A global element declaration to a Element interface | Java Element interface |
Local element declaration that can be inserted into a general content list | Java Element interface |
Attribute | Java property |
No comments:
Post a Comment