|
|||||||||
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();
}
}
org.apache.xerces.impl.validation.datatypes.IDDatatypeValidator
,
org.apache.xerces.impl.validation.datatypes.AbstractDatatypeValidator
,
org.apache.xerces.impl.validation.DatatypeValidator
Fields inherited from class org.apache.xerces.impl.dv.dtd.AbstractDatatypeValidator |
fFacets |
Constructor Summary | |
IDREFDatatypeValidator()
|
|
IDREFDatatypeValidator(DatatypeValidator base,
java.util.Hashtable facets,
boolean derivedByList)
|
Method Summary | |
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
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.org.apache.xerces.validators.datatype.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 -
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
tableOfIDs
- public int compare(java.lang.String content1, java.lang.String content2)
o1
- o2
- public java.util.Hashtable getFacets()
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
public void setLocale(java.util.Locale locale)
public java.lang.Object getInternalStateInformation()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |