| Modifier and Type | Field and Description |
|---|---|
| public static final int | ID_TYPE_ID
Indicates that RELAX NG compatibility processors should treat this datatype as having ID semantics. |
| public static final int | ID_TYPE_IDREF
Indicates that RELAX NG compatibility processors should treat this datatype as having IDREF semantics. |
| public static final int | ID_TYPE_IDREFS
Indicates that RELAX NG compatibility processors should treat this datatype as having IDREFS semantics. |
| public static final int | ID_TYPE_NULL
Indicates that the datatype doesn't have ID/IDREF semantics. |
| Modifier and Type | Method and Description |
|---|---|
| public void | checkValid(String literal, ValidationContext context)
Similar to the isValid method but throws an exception with diagnosis in case of errors. |
| public DatatypeStreamingValidator | createStreamingValidator(ValidationContext
If this datatype is context-dependent
(i.e. the context)isContextDependent method returns true),
then the caller must provide a non-null valid context object.
Otherwise, the caller can pass null.
The callee may keep a reference to this context object
only while the returned streaming validator is being used.Creates an instance of a streaming validator for this type. |
| public Object | Returns: null when the given lexical value is not a valid lexical value for this type.If this datatype is context-dependent
(when the context)isContextDependent method returns true),
then the caller must provide a non-null valid context object.
Otherwise, the caller can pass null.Converts lexcial value and the current context to the corresponding value object. |
| public int | Returns: If this datatype doesn't have any ID/IDREF semantics, it returnsID_TYPE_NULL. If it has such a semantics
(for example, XSD:ID, XSD:IDREF and comp:ID type), then
it returns ID_TYPE_ID, ID_TYPE_IDREF or
ID_TYPE_IDREFS.Checks if the ID/IDREF semantics is associated with this datatype. |
| public boolean | Returns: true if this datatype is context-dependent (it needs a context object sometimes); false if this datatype is context-independent (it never needs a context object).Checks if this datatype may need a context object for the validation. |
| public boolean | Returns: true if the 'literal' is a member of this Datatype; false if it's not a member of this Datatype.the lexical representation to be checked. literal, ValidationContext If this datatype is context-dependent
(i.e. the context)isContextDependent method returns true),
then the caller must provide a non-null valid context object.
Otherwise, the caller can pass null.Checks if the specified 'literal' matches this Datatype with respect to the current context. |
| public boolean | |
| public int | Returns: hash code for the specified value object.Computes the hash code for a value object, which is consistent with the sameValue method. |
| ID_TYPE_ID | back to summary |
|---|---|
| public static final int ID_TYPE_ID Indicates that RELAX NG compatibility processors should
treat this datatype as having ID semantics.
This value is one of the possible return values of the
| |
| ID_TYPE_IDREF | back to summary |
|---|---|
| public static final int ID_TYPE_IDREF Indicates that RELAX NG compatibility processors should
treat this datatype as having IDREF semantics.
This value is one of the possible return values of the
| |
| ID_TYPE_IDREFS | back to summary |
|---|---|
| public static final int ID_TYPE_IDREFS Indicates that RELAX NG compatibility processors should
treat this datatype as having IDREFS semantics.
This value is one of the possible return values of the
| |
| ID_TYPE_NULL | back to summary |
|---|---|
| public static final int ID_TYPE_NULL Indicates that the datatype doesn't have ID/IDREF semantics.
This value is one of the possible return values of the
| |
| checkValid | back to summary |
|---|---|
| public void checkValid(String literal, ValidationContext context) throws DatatypeException Similar to the isValid method but throws an exception with diagnosis in case of errors. If the specified 'literal' is a valid lexical representation for this datatype, then this method must return without throwing any exception. If not, the callee must throw an exception (with diagnosis message, if possible.) The application can use this method to provide detailed error message to users. This method is kept separate from the isValid method to achieve higher performance during normal validation.
| |
| createStreamingValidator | back to summary |
|---|---|
| public DatatypeStreamingValidator createStreamingValidator(ValidationContext context) Creates an instance of a streaming validator for this type. By using streaming validators instead of the isValid method, the caller can avoid keeping the entire string, which is sometimes quite big, in memory.
| |
| createValue | back to summary |
|---|---|
| public Object createValue(String literal, ValidationContext context) Converts lexcial value and the current context to the corresponding value object.
The caller cannot generally assume that the value object is
a meaningful Java object. For example, the caller cannot expect
this method to return
Also, the caller cannot assume that the equals method and
the hashCode method of the value object are consistent with
the semantics of the datatype. For that purpose, the sameValue
method and the valueHashCode method have to be used. Note that
this means you cannot use classes like
The returned value object should be used solely for the sameValue and valueHashCode methods.
| |
| getIdType | back to summary |
|---|---|
| public int getIdType() Checks if the ID/IDREF semantics is associated with this datatype. This method is introduced to support the RELAX NG DTD compatibility spec. (Of course it's always free to use this method for other purposes.)
If you are implementing a datatype library and have no idea about
the "RELAX NG DTD compatibility" thing, just return
| |
| isContextDependent | back to summary |
|---|---|
| public boolean isContextDependent() Checks if this datatype may need a context object for the validation. The callee must return true even when the context is not always necessary. (For example, the "QName" type doesn't need a context object when validating unprefixed string. But nonetheless QName must return true.)
XSD's
When a datatype is context-independent, then
the
| |
| isValid | back to summary |
|---|---|
| public boolean isValid(String literal, ValidationContext context) Checks if the specified 'literal' matches this Datatype with respect to the current context.
| |
| sameValue | back to summary |
|---|---|
| public boolean sameValue(Object value1, Object value2) Tests the equality of two value objects which were originally created by the createValue method of this object. The behavior is undefined if objects not created by this type are passed. It is the caller's responsibility to ensure that value objects belong to this type.
| |
| valueHashCode | back to summary |
|---|---|
| public int valueHashCode(Object value) Computes the hash code for a value object, which is consistent with the sameValue method.
| |