## org.apache.xerces.validators.datatype
Class DatatypeValidatorFactoryImpl

    java.lang.Object
      |
      +--org.apache.xerces.validators.datatype.DatatypeValidatorFactoryImpl

public class DatatypeValidatorFactoryImpl
extends java.lang.Object
implements DatatypeValidatorFactory

This class implements a factory of datatype validators. Internally the DatatypeValidators are kept in three registries:
(i) DTDRegistry - stores DTD datatype validators <ii> SchemaRegistry - stores Schema datatype validators <iii> UserDefinedRegistry - stores Schema user defined datatypes.
The above registries will be initialized on demand (for XML document with a DTD, only DTDRegistry will be initialized).
Note: Between multiple parse() calls, only _user_defined_ registry will be reset. DTD registry and schema registry are initialized only once and are kept for the *life-time* of the parser .
This implementation uses a Hahtable as a registry table but future implementation should use a lighter object, maybe a Map class ( not use a derived Map class because of JDK 1.1.8 no supporting Map).
As the Parser parses an instance document it knows if validation needs to be checked. If no validation is necessary we should not instantiate a DatatypeValidatorFactoryImpl.

Version:
  $Id: DatatypeValidatorFactoryImpl.java,v 1.33 2001/08/01 12:46:57 sandygao Exp $
Author:
  Elena Litani, Jeffrey Rodriguez, Mark Swinkles - List Validation refactoring

Constructor Summary
`DatatypeValidatorFactoryImpl()`

Method Summary
`DatatypeValidator` `createDatatypeValidator(java.lang.String typeName, DatatypeValidator base, java.util.Hashtable facets, boolean list)`
`DatatypeValidator` `createDatatypeValidator(java.lang.String typeName, java.util.Vector validators)`
`void` `expandRegistryToFullSchemaSet()` Initializes fSchemaDatatypeRegistry with schema primitive and derived datatypes.
`DatatypeValidator` `getDatatypeValidator(java.lang.String type)` Searches different datatype registries depending on validation mode (schema or dtd)
`void` `initializeDTDRegistry()` Initializes fDTDRegistry with (9) DTD related datatypes .
`void` `resetRegistry()` An optimization option that we should write in the future is to separate the static list of Datatype Validators from the dynamic part where anonymous, and user derived datatype are kept, then when we resetRegistry only the dynamic part of the registry should be cleared.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DatatypeValidatorFactoryImpl

    public DatatypeValidatorFactoryImpl()

Method Detail

### initializeDTDRegistry

    public void initializeDTDRegistry()

  Initializes fDTDRegistry with (9) DTD related datatypes .

### expandRegistryToFullSchemaSet

    public void expandRegistryToFullSchemaSet()

  Initializes fSchemaDatatypeRegistry with schema primitive and derived datatypes. See W3C Schema Datatype REC. If DTD registry is not initialized yet, this method will initialize it as well.

### resetRegistry

    public void resetRegistry()

  An optimization option that we should write in the future is to separate the static list of Datatype Validators from the dynamic part where anonymous, and user derived datatype are kept, then when we resetRegistry only the dynamic part of the registry should be cleared. So we don't end up clearing the static part of the table over and over every time that we do a parse cycle.

### createDatatypeValidator

    public DatatypeValidator createDatatypeValidator(java.lang.String typeName,
                                                     DatatypeValidator base,
                                                     java.util.Hashtable facets,
                                                     boolean list)
                                              throws InvalidDatatypeFacetException

  Specified by:
    createDatatypeValidator in interface DatatypeValidatorFactory

### createDatatypeValidator

    public DatatypeValidator createDatatypeValidator(java.lang.String typeName,
                                                     java.util.Vector validators)

### getDatatypeValidator

    public DatatypeValidator getDatatypeValidator(java.lang.String type)

  Searches different datatype registries depending on validation mode (schema or dtd)
  Parameters:
    `type` -
  Returns:

Copyright © 1999-2001 Apache XML Project. All Rights Reserved.