org.apache.xerces.impl.dv.dtd
Class DatatypeValidatorFactoryImpl

java.lang.Object
  |
  +--org.apache.xerces.impl.dv.dtd.DatatypeValidatorFactoryImpl
All Implemented Interfaces:
DatatypeValidatorFactory

public class DatatypeValidatorFactoryImpl
extends java.lang.Object
implements DatatypeValidatorFactory

This class implements a factory of Datatype Validators. Internally the DatatypeValidators are kept in a registry.
There is one instance of DatatypeValidatorFactoryImpl per Parser.
There is one datatype Registry per instance of DatatypeValidatorFactoryImpl, such registry is first allocated with the number DatatypeValidators needed.
e.g. If Parser finds an XML document with a DTD, a registry of DTD validators (only 9 validators) get initialized in the registry. The initialization process consist of instantiating the Datatype and facets and registering the Datatype into registry table. This implementatio 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 necesary we should not instantiate a DatatypeValidatorFactoryImpl.
If validation is needed, we need to instantiate a DatatypeValidatorFactoryImpl.

Version:
$Id: DatatypeValidatorFactoryImpl.java,v 1.3 2002/01/29 01:15:11 lehors Exp $
Author:
Jeffrey Rodriguez

Field Summary
protected static java.util.Hashtable fgBaseTypes
           
protected static boolean fgRegistryExpanded
           
protected  java.util.Hashtable fUserDefinedTypes
           
 
Constructor Summary
DatatypeValidatorFactoryImpl()
           
 
Method Summary
 DatatypeValidator createDatatypeValidator(java.lang.String name, DatatypeValidator base, java.util.Hashtable facets, boolean list)
          Create datatype validator.
 DatatypeValidator getDatatypeValidator(java.lang.String type)
           
 void initializeDTDRegistry()
          Initializes registry with primitive and derived Simple types.
 void resetRegistry()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fgBaseTypes

protected static final java.util.Hashtable fgBaseTypes

fgRegistryExpanded

protected static boolean fgRegistryExpanded

fUserDefinedTypes

protected java.util.Hashtable fUserDefinedTypes
Constructor Detail

DatatypeValidatorFactoryImpl

public DatatypeValidatorFactoryImpl()
Method Detail

initializeDTDRegistry

public void initializeDTDRegistry()
Initializes registry with primitive and derived Simple types. This method does not clear the registry to clear the registry you have to call resetRegistry. The net effect of this method is to start with a the smallest set of datatypes needed by the validator. If we start with DTD's then we initialize the table to only the 9 validators needed by DTD Validation. If we start with Schema's then we initialize to to full set of validators.
Parameters:
registrySet -  

resetRegistry

public void resetRegistry()

createDatatypeValidator

public DatatypeValidator createDatatypeValidator(java.lang.String name,
                                                 DatatypeValidator base,
                                                 java.util.Hashtable facets,
                                                 boolean list)
                                          throws InvalidDatatypeFacetException,
                                                 InvalidDatatypeValueException
Create datatype validator.
Specified by:
createDatatypeValidator in interface DatatypeValidatorFactory
Parameters:
name - Name of type.
base - The base type, or null if there is no base type.
facets - The facets.
list - True if this type is a list.
Returns:
The new datatype validator.

getDatatypeValidator

public DatatypeValidator getDatatypeValidator(java.lang.String type)


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