Version 7

    What java data types are supported?

     

    For details see JAXRPC-1.1 - Java API for XML-based RPC section 4.2 XML to Java Type Mapping.

     

    Note, JAXRPC does not offer support for Java object graphs nor Java collections.

     

    Simple Types

     

    The following table specifies the Java mapping for the built-in simple XML data types.

    These XML data types are as defined in the XML schema specification

     

    Java mapping for the built-in simple XML data types

     

    Simple Type

    Java 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:unsignedInt

    long

    xsd:unsignedShort

    int

    xsd:unsignedByte

    short

    xsd:QName

    javax.xml.namespace.QName

    xsd:dateTime

    java.util.Calendar

    xsd:date

    java.util.Calendar

    xsd:time

    java.util.Calendar

    xsd:anyURI

    java.net.URI

    xsd:base64Binary

    byte{FOOTNOTE DEF  }

    xsd:hexBinary

    byte{FOOTNOTE DEF  }

    xsd:anySimpleType

    java.lang.String

     

    The JAX-RPC specification does not define the standard Java mapping for the

    xsd:anyType. A JAX-RPC implementation is not required to support the xsd:anyType.

     

    Derived Java mapping for the remaining built-in simple XML data types

     

    Simple Type

    Java Type

    xsd:duration

    java.lang.String

    xsd:gYearMonth

    java.lang.String

    xsd:gYear

    java.lang.String

    xsd:gMonthDay

    java.lang.String

    xsd:gDay

    java.lang.String

    xsd:gMonth

    java.lang.String

    xsd:normalizedString

    java.lang.String

    xsd:token

    java.lang.String

    xsd:language

    java.lang.String

    xsd:Name

    java.lang.String

    xsd:NCName

    java.lang.String

    xsd:ID

    java.lang.String

    xsd:NMTOKEN

    java.lang.String

    xsd:NMTOKENS

    java.lang.String{FOOTNOTE DEF  }

    xsd:nonPositiveInteger

    java.math.BigInteger

    xsd:negativeInteger

    java.math.BigInteger

    xsd:nonNegativeInteger

    java.math.BigInteger

    xsd:unsignedLong

    java.math.BigInteger

    xsd:positiveInteger

    java.math.BigInteger

     

    There are a number of cases in which a built-in simple XML data type must be mapped

    to the corresponding Java wrapper class for the Java primitive type:

    • an element declaration with the nillable attribute set to true;

    • an element declaration with the minOccurs attribute set to 0 (zero) and the maxOccurs attribute set to 1 (one) or absent;

    • an attribute declaration with the use attribute set to optional or absent and carrying neither the default nor the fixed attribute;

     

    XML Struct and Complex Type

     

    The JAX-RPC specification supports the mapping of the following types of XML struct:

    • The xsd:complexType with both sequence of elements of either simple or complex type.

    • The xsd:complexType with xsd:all based unordered grouping of elements of either simple or complex type

    • The xsd:complexType with xsd:simpleContent used to declare a complex type by extension of an existing simple type

     

    In all cases, attribute uses specified using either the xsd:attribute or xsd:attributeGroup elements are supported.

     

    An XML struct maps to a JavaBeans class with the same name as the type of the XML struct. If the struct is anonymous, then the name of the nearest enclosing xsd:element, xsd:complexType or xsd:simpleType is used instead.

     

    The mapped JavaBeans class provides a pair of getter and setter methods for each property mapped from the member elements and attributes of the XML struct.

     

    The identifier and Java type of a property in the JavaBeans class is mapped from the name and type of the corresponding member element (or attribute) in the XML struct. Refer to the section 4.1, &147;XML Names&148; for the mapping of XML names to Java identifiers.

     

    Note that, according to JavaBeans conventions, the getter method for a boolean property uses the prefix &147;is&148; instead of &147;get&148;, e.g. isRequired().

     

    For complex types defined using xsd:simpleContent and extending a simple type T, the corresponding JavaBean class will contain an additional property named &147;_value&147; and whose type is mapped from the simple type T according to the rules in this specification.

     

    The instances of the mapped JavaBeans class must be capable of marshaling to and from the corresponding XML struct representation.

     

    An element in a complex type with the maxOccurs attribute set to a non-negative integer greater than 1 or unbounded is mapped to a Java array with a pair of setter and getter methods in the JavaBeans class. The Java type of the array is mapped from the type attribute of the XML element.

     

    -


    Referenced by: