ListDatatypeValidatorpublic class ListDatatypeValidator extends Object implements DatatypeValidatorFor list types: ENTITIES, IDREFS, NMTOKENS. |
Fields Summary |
---|
final DatatypeValidator | fItemValidator |
Constructors Summary |
---|
public ListDatatypeValidator(DatatypeValidator itemDV)
fItemValidator = itemDV;
|
Methods Summary |
---|
public void | validate(java.lang.String content, ValidationContext context)Checks that "content" string is valid.
If invalid a Datatype validation exception is thrown.
StringTokenizer parsedList = new StringTokenizer(content," ");
int numberOfTokens = parsedList.countTokens();
if (numberOfTokens == 0) {
throw new InvalidDatatypeValueException("EmptyList", null);
}
//Check each token in list against base type
while (parsedList.hasMoreTokens()) {
this.fItemValidator.validate(parsedList.nextToken(), context);
}
|
|