The sample implementation of TREX in Java supports XML Schema Part 2 as its datatyping language. The version of XML Schema currently supported is the Candidate Recommendation.
Datatypes are supported as follows:
string
boolean
float
double
decimal
timeDuration
string
.recurringDuration
binary
uriReference
string
.ID
NCName
.IDREF
NCName
.ENTITY
NCName
.QName
CDATA
token
language
string
.IDREFS
NCName
.ENTITIES
NCName
.NMTOKEN
NMTOKENS
Name
NCName
NOTATION
Name
.integer
nonPositiveInteger
negativeInteger
long
int
short
byte
nonNegativeInteger
unsignedLong
unsignedInt
unsignedShort
unsignedByte
positiveInteger
timeInstant
string
.time
timePeriod
date
month
year
century
recurringDate
recurringDay
Derivation of new datatypes by restriction, list and union is
supported. The element bearing the trex:role="datatype"
attribute must be a restriction
, list
,
union
or simpleType
element.
Facets are supported as follows:
length
minLength
maxLength
pattern
enumeration
whiteSpace
maxInclusive
maxExclusive
minInclusive
minExclusive
precision
scale
encoding
duration
period
The implementation of the pattern
facet requires an
implementation of regular expressions as defined in XML Schema Part
2. The name of the class implementing the interface
com.thaiopensource.datatype.xsd.RegexEngine
must be
specified as the value of the
com.thaiopensource.trex.util.RegexEngine
system property.
If no such class is available, then any pattern will be assumed to
match any string.
The class
com.thaiopensource.trex.util.XercesRegexEngine
implements
com.thaiopensource.datatype.xsd.RegexEngine
using the
package org.apache.xerces.utils.regex
which is included
in the Xerces XML Parser. To use
this, an option of
-Dcom.thaiopensource.trex.util.RegexEngine=com.thaiopensource.trex.util.XercesRegexEngine
would be added to the invocation of the java
command. There is a trivial bug in the current (1.3.0) version of
Xerces, which makes invalid regular expressions cause a
NullPointerException. The bug
report describes a workaround.
Alternatively, you can use IBM's Regex for Java package, available
from Alphaworks. You can
create a RegexEngine
that uses this simply by changing
org.apache.xerces.utils
to com.ibm
in
com/thaiopensource/trex/util/XercesRegexEngine.java
. The
sample implementation does not include such a class because the
license for Regex for Java is currently rather restrictive.