|
|||||||||
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.IDDatatypeValidator
IDDatatypeValidator - ID represents the ID attribute type from XML 1.0 Recommendation. The value space od ID is the set of all strings that match the NCName production and have been used in an XML document. The lexical space of ID is the set of all strings that match the NCName production.
The value space of ID is scoped to a specific instance document.
The following constraint applies: An ID must not appear more than once in an XML document as a value of this type; i.e., ID values must uniquely identify the elements which bear them.
An ID validator is a statefull validator, it needs read/write access to the associated instant document table of IDs.
The following snippet shows typical use of the the IDDatatype:
DatatypeValidator idData = tstRegistry.getDatatypeValidator( "ID" );
if ( idData != null ) {
((IDDatatypeValidator) idData).initialize();
try {
idData.validate( "a1", null );
idData.validate( "a2", null );
} catch ( Exception ex ) {
ex.printStackTrace();
}
Hashtable tst = (Hashtable)((IDDatatypeValidator) idData).getTableIds();
if (tst != null) {
System.out.println("Table of ID = " + tst.toString());
}
}
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();
}
}
AbstractDatatypeValidator
,
DatatypeValidator
,
IDREFDatatypeValidator
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 | |
IDDatatypeValidator()
|
|
IDDatatypeValidator(DatatypeValidator base,
java.util.Hashtable facets,
boolean derivedByList)
|
Method Summary | |
java.lang.Object |
clone()
Return 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()
This method is unique to IDDatatypeValidator. |
void |
initialize(java.lang.Object tableOfIDs)
Initializes internal table of IDs used by ID datatype validator to keep track of ID's. |
void |
setLocale(java.util.Locale locale)
set the locate to be used for error messages |
void |
validate()
A no-op method in this Datatype |
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 IDDatatypeValidator() throws InvalidDatatypeFacetException
public IDDatatypeValidator(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 validatedstate
- Generic Object state that can be use to pass
Structuresthrows
- InvalidDatatypeException if the content is
invalid according to the rules for the validatorsInvalidDatatypeValueException
- InvalidDatatypeValueException
public void validate() throws InvalidDatatypeValueException
validate
in interface StatefullDatatypeValidator
public void initialize(java.lang.Object tableOfIDs)
initialize
in interface StatefullDatatypeValidator
state
- This is a dummy parameter.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 java.lang.Object getInternalStateInformation()
getInternalStateInformation
in interface StatefullDatatypeValidator
public void setLocale(java.util.Locale locale)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |