FileDocCategorySizeDatePackage
ValidationState.javaAPI DocApache Xerces 3.0.15889Fri Sep 14 20:33:52 BST 2007org.apache.xerces.impl.validation

ValidationState

public class ValidationState extends Object implements org.apache.xerces.impl.dv.ValidationContext
Implementation of ValidationContext inteface. Used to establish an environment for simple type validation.
xerces.internal
author
Elena Litani, IBM
version
$Id: ValidationState.java 446719 2006-09-15 20:32:39Z mrglavas $

Fields Summary
private boolean
fExtraChecking
private boolean
fFacetChecking
private boolean
fNormalize
private boolean
fNamespaces
private EntityState
fEntityState
private org.apache.xerces.xni.NamespaceContext
fNamespaceContext
private org.apache.xerces.util.SymbolTable
fSymbolTable
private final Hashtable
fIdTable
private final Hashtable
fIdRefTable
private static final Object
fNullValue
Constructors Summary
Methods Summary
public voidaddId(java.lang.String name)

        fIdTable.put(name, fNullValue);
    
public voidaddIdRef(java.lang.String name)

        fIdRefTable.put(name, fNullValue);
    
public java.lang.StringcheckIDRefID()
return null if all IDREF values have a corresponding ID value; otherwise return the first IDREF value without a matching ID value.

        Enumeration en = fIdRefTable.keys();

        String key;
        while (en.hasMoreElements()) {
            key = (String)en.nextElement();
            if (!fIdTable.containsKey(key)) {
                  return key;
            }
        }
        return null;
    
public java.lang.StringgetSymbol(java.lang.String symbol)

        if (fSymbolTable != null)
            return fSymbolTable.addSymbol(symbol);
        // if there is no symbol table, we return java-internalized string,
        // because symbol table strings are also java-internalzied.
        // this guarantees that the returned string from this method can be
        // compared by reference with other symbol table string. -SG
        return symbol.intern();
    
public java.lang.StringgetURI(java.lang.String prefix)

        if (fNamespaceContext !=null) {
            return fNamespaceContext.getURI(prefix);
        }
        return null;
    
public booleanisEntityDeclared(java.lang.String name)

        if (fEntityState !=null) {
            return fEntityState.isEntityDeclared(getSymbol(name));
        }
        return false;
    
public booleanisEntityUnparsed(java.lang.String name)

        if (fEntityState !=null) {
            return fEntityState.isEntityUnparsed(getSymbol(name));
        }
        return false;
    
public booleanisIdDeclared(java.lang.String name)

        return fIdTable.containsKey(name);
    
public booleanneedExtraChecking()

        return fExtraChecking;
    
public booleanneedFacetChecking()

        return fFacetChecking;
    
public booleanneedToNormalize()

        return fNormalize;
    
public voidreset()

        fExtraChecking = true;
        fFacetChecking = true;
        fNamespaces = true;
        fIdTable.clear();
        fIdRefTable.clear();
        fEntityState = null;
        fNamespaceContext = null;
        fSymbolTable = null;
    
public voidresetIDTables()
The same validation state can be used to validate more than one (schema) validation roots. Entity/Namespace/Symbol are shared, but each validation root needs its own id/idref tables. So we need this method to reset only the two tables.

        fIdTable.clear();
        fIdRefTable.clear();
    
public voidsetEntityState(EntityState state)

        fEntityState = state;
    
public voidsetExtraChecking(boolean newValue)


    //
    // public methods
    //
        
        fExtraChecking = newValue;
    
public voidsetFacetChecking(boolean newValue)

        fFacetChecking = newValue;
    
public voidsetNamespaceSupport(org.apache.xerces.xni.NamespaceContext namespace)

        fNamespaceContext = namespace;
    
public voidsetNormalizationRequired(boolean newValue)

          fNormalize = newValue;
    
public voidsetSymbolTable(org.apache.xerces.util.SymbolTable sTable)

        fSymbolTable = sTable;
    
public voidsetUsingNamespaces(boolean newValue)

          fNamespaces = newValue;
    
public booleanuseNamespaces()

        return fNamespaces;