|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.xerces.impl.dv.dtd.AbstractDatatypeValidator | +--org.apache.xerces.impl.dv.dtd.IDREFDatatypeValidator
IDREFDatatypeValidator - represents the IDREFS attribute type from XML 1.0 recommendation. The Value Space of IDREF is the set of all strings that match the NCName production and have been used in an XML Document as the value of an element or attribute of Type ID. The Lexical space of IDREF is the set of strings that match the NCName production.
The Value space of IDREF is scoped to a specific instance document
This datatatype checks the following constraint: An IDREF must match the value of an ID in the XML document in which it occurs.
The following snippet shows typical use of the the IDDatatype:
DatatypeValidator idRefData = tstRegistry.getDatatypeValidator("IDREF" );
if( idRefData != null ){
IDREFDatatypeValidator refData = (IDREFDatatypeValidator) idRefData;
refData.initialize( ((IDDatatypeValidator) idData).getTableIds());
try {
refData.validate( "a1", null );
refData.validate( "a2", null );
//refData.validate( "a3", null );//Should throw exception at validate()
refData.validate();
} catch( Exception ex ){
ex.printStackTrace();
}
}
IDDatatypeValidator
,
DatatypeValidator
,
DatatypeValidator
Fields inherited from class org.apache.xerces.impl.dv.dtd.AbstractDatatypeValidator |
fFacets |
Fields inherited from interface org.apache.xerces.impl.dv.dtd.DatatypeValidator |
FACET_DURATION, FACET_ENCODING, FACET_ENUMERATION, FACET_LENGTH, FACET_MAXEXCLUSIVE, FACET_MAXINCLUSIVE, FACET_MAXLENGTH, FACET_MINEXCLUSIVE, FACET_MININCLUSIVE, FACET_MINLENGTH, FACET_PATTERN, FACET_PERIOD, FACET_PRECISSION, FACET_SCALE, FACET_WHITESPACE, WHITESPACE_COLLAPSE, WHITESPACE_NONE, WHITESPACE_PRESERVE, WHITESPACE_REPLACE |
Constructor Summary | |
IDREFDatatypeValidator()
|
|
IDREFDatatypeValidator(DatatypeValidator base,
java.util.Hashtable facets,
boolean derivedByList)
|
Method Summary | |
void |
checkIdRefs(java.util.Hashtable idrefs,
java.util.Hashtable ids)
Private method used to check the IDREF valid ID constraint |
java.lang.Object |
clone()
Returns a copy of this object. |
int |
compare(java.lang.String content1,
java.lang.String content2)
REVISIT Compares two Datatype for order |
java.util.Hashtable |
getFacets()
getFacets |
java.lang.Object |
getInternalStateInformation()
A no-op method in this validator |
void |
initialize(java.lang.Object tableOfIDs)
This method is unique to IDREFDatatypeValidator |
void |
setLocale(java.util.Locale locale)
set the locate to be used for error messages |
void |
validate()
This method is unique to IDREFDatatypeValidator |
void |
validate(java.lang.String content,
java.lang.Object state)
Checks that "content" string is valid datatype. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public IDREFDatatypeValidator() throws InvalidDatatypeFacetException
public IDREFDatatypeValidator(DatatypeValidator base, java.util.Hashtable facets, boolean derivedByList) throws InvalidDatatypeFacetException
Method Detail |
public void validate(java.lang.String content, java.lang.Object state) throws InvalidDatatypeValueException
validate
in class AbstractDatatypeValidator
content
- A string containing the content to be validatedderivedBylist
- Flag which is true when type
is derived by list otherwise it
it is derived by extension.throws
- InvalidDatatypeException if the content is
invalid according to the rules for the validatorsInvalidDatatypeValueException
- InvalidDatatypeValueException
public void validate() throws InvalidDatatypeValueException
This method is unique to IDREFDatatypeValidator
Validator should call this method at the EndDocument call to start IDREF constraint validation. This validation rule checks IDREF values accumulated in internal table against read table passed to IDREF validator at instantiation time.
Caveats -
validate
in interface StatefullDatatypeValidator
InvalidDatatypeValueException
- public void initialize(java.lang.Object tableOfIDs)
This method is unique to IDREFDatatypeValidator
This method initializes the internal reference to the ID table of ID's and IDREF internal table of IDREFs.
This method should be called before the valid() method
initialize
in interface StatefullDatatypeValidator
tableOfIDs
- public int compare(java.lang.String content1, java.lang.String content2)
compare
in class AbstractDatatypeValidator
o1
- o2
- public java.util.Hashtable getFacets()
AbstractDatatypeValidator
getFacets
in class AbstractDatatypeValidator
org.apache.xerces.impl.dv.dtd.AbstractDatatypeValidator
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
public void checkIdRefs(java.util.Hashtable idrefs, java.util.Hashtable ids) throws InvalidDatatypeValueException
Private method used to check the IDREF valid ID constraint
InvalidDatatypeValueException
- public void setLocale(java.util.Locale locale)
public java.lang.Object getInternalStateInformation()
getInternalStateInformation
in interface StatefullDatatypeValidator
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |