Package com.sun.msv.datatype.xsd
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.
Object types returned by the 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.
- *1
- The first item in the array is the namespace URI. The second (the last) item in the array is the local name.
- *2
-
Missing fields are not set. For example, "gYearMonth" type returns
a Calendar object whose DAY_OF_MONTH, HOUR_OF_DAY, MINUTE,SECOND, and
MILLISECOND fields are not set.
If the XML representation does not contain the millisecond part,
then
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"). - *3
- The anyURI type does not perform URI escaping. So it returns "%20" for the lexical value "%20".
- *4
- The language type always return a string in the lower case. That is, it returns "en_us" for "EN_US".
- *5
- Strings are white-space normalized according to the value of the whiteSpace facet. For example, " abc " as a Name yields "abc"; " abc " as a string yields " abc ".
-
ClassDescription"anyURI" type."base64Binary" type."boolean" type.base class for atomic built-in types; those types which can be used by itself (int,uriReference,string, etc) ."byte" type.command-line tester of datatype library.Comparable datatype.base class for types that union/list/atomic.Datatype object factory.Base implementation of facet-restricted datatype"dateTime" type."date" type."double" type."duration" type."ENTITY" type."enumeration" facets validator.A dummy datatype that can be used to recover from errors."final" component."float" type.'fractionDigits' facet."gDay" type."gMonthDay" type."gMonth" type."gYearMonth" type."gYear" type."hexBinary" type.very limited 'IDREF' type of XML Schema Part 2.very limited 'ID' type of XML Schema Part 2."integer" type.Value object of "integer" type."int" type."language" type."length", "minLength", and "maxLength" facet validator.List type.value object of ListType."long" type.'maxExclusive' facet'maxInclusive' facet'maxLength' facet'minExclusive' facet'minInclusive' facet'minLength' facet"Name" type."NCName" type."negativeInteger" type."NMTOKEN" type."nonNegativeInteger" type."nonPositiveInteger" type."normalizedString" type."decimal" type."pattern" facet validator "pattern" is a constraint facet which is applied against lexical space."positiveInteger" type.Delegates all methods to the base type."QName" type.value object of QName.Base class of "(max|min)(In|Ex)clusive" facet validator"short" type.simple "ur-type" type."string" type."time" type."token" type.'totalDigits' facet.derives a new type by adding facets.Unicode-related utility functions.union type."unsignedByte" type."unsignedInt" type."unsignedLong" type."unsignedShort" type.whiteSpace facet validatorprocesses white space normalizationThis class contains static methods used to determine whether identifiers may appear in certain roles in XML documents.Publicly accesible interface of W3C XML Schema datatype (simple type).base implementaion for XSDatatype interface.