org.relaxng.datatype
Interface CompatibilityDatatype

All Superinterfaces:
Datatype

public interface CompatibilityDatatype
extends Datatype

Datatype with the support of the RELAX NG compatibility spec.

This interface defines additional features which are necessary for datatypes to work with RELAX NG compatibility processors.

Author:
James Clark, Kohsuke KAWAGUCHI

Field Summary
static int ID_TYPE_ID
          Indicates that RELAX NG compatibility processors should treat this datatype as having ID semantics.
static int ID_TYPE_IDREF
          Indicates that RELAX NG compatibility processors should treat this datatype as having IDREF semantics.
static int ID_TYPE_IDREFS
          Indicates that RELAX NG compatibility processors should treat this datatype as having IDREFS semantics.
static int ID_TYPE_NULL
          Indicates that the datatype doesn't have ID/IDREF semantics.
 
Method Summary
 int getIdType()
          Checks if the ID/IDREF semantics is associated with this datatype.
 boolean isContextDependent()
          Checks if this datatype may need a context object for the validation.
 
Methods inherited from interface org.relaxng.datatype.Datatype
checkValid, createStreamingValidator, createValue, isValid, sameValue, valueHashCode
 

Field Detail

ID_TYPE_NULL

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 getIdType() method.

ID_TYPE_ID

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 getIdType() method.

ID_TYPE_IDREF

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 getIdType() method.

ID_TYPE_IDREFS

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 getIdType() method.
Method Detail

getIdType

public int getIdType()
Checks if the ID/IDREF semantics is associated with this datatype.
Returns:
If this datatype doesn't have any ID/IDREF semantics, it returns ID_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.

isContextDependent

public boolean isContextDependent()
Checks if this datatype may need a context object for the validation.

The callee must return true even if the context is not always necessary.

XSD's string and short types are examples of context-independent datatypes. QName and ENTITY types are examples of context-dependent datatypes.

Returns:
true if this datatype is context-dependent (it needs a context object sometimes); false if this datatype is context-independend (it never need a context object).