This package implements the recommendation version of W3C XML Schema Part 2 datatypes. The latest version of the spec is here.
Application developers should understand the usage of
the following classes:
com.sun.msv.datatype.xsd.DatatypeFactory
,
com.sun.msv.datatype.xsd.XSDatatype
,
org.relaxng.datatype.Datatype
, and
org.relaxng.datatype.ValidationContext
.
Other classes are implementations of those types and therefore not important in most cases.
The current release has several limitations. See readme.txt for details.
createJavaObject
method
The following W3C XML Schema types return java.lang.String
, with no loss of accuracy.
The "language" type also returns java.lang.String
, but it always returns a string in all lower-case.
The "anyURI" type returns java.lang.String
too. It doesn't perform any escaping. So
"%20" as a value of the "anyURI" type results in "%20", not " ".
For other types:
XSD type | Java type |
string | java.lang.String(*5) |
ENTITY | |
normalizedString | |
token | |
NMTOKEN | |
Name | |
NCName | |
NOTATION | |
anyURI (*3) | |
language (*4) | |
boolean | java.lang.Boolean |
number | java.math.BigDecimal |
float | java.lang.Float |
double | java.lang.Double |
integer |
a derived class of java.lang.Number |
negativeInteger | |
positiveInteger | |
nonNegativeInteger | |
nonPositiveInteger | |
unsignedLong | |
unsignedInt | |
unsignedShort | |
unsignedByte | |
long | |
int | |
short | |
byte | |
QName | java.lang.String[2](*1) |
base64Binary | byte[] |
hexBinary | |
dateTime | java.util.Calendar(*2) |
date | |
time | |
gYear | |
gYearMonth | |
gMonth | |
gMonthDay | |
gDay |
For types derived by list, the createJavaObject method returns java.lang.Object[]
that contains Java values of the item type.
For types derived by restriction, the method returns the same type as the base type.
For types derived by union, the method returns Java values of one of the member types.
The createJavaObject method currently returns meaningless types for "duration" datatype.
MILLISECOND
field of the returned Calendar object
is not set. This field is set only when the XML representation contains
fractional seconds (e.g., "01:02:03.5").