FileDocCategorySizeDatePackage
ValidationState.javaAPI DocJava SE 5 API7632Fri Aug 26 14:55:48 BST 2005com.sun.org.apache.xerces.internal.impl.validation

ValidationState

public class ValidationState extends Object implements ValidationContext
Implementation of ValidationContext inteface. Used to establish an environment for simple type validation.
author
Elena Litani, IBM
version
$Id: ValidationState.java,v 1.13 2003/06/05 21:50:30 neilg Exp $

Fields Summary
private boolean
fExtraChecking
private boolean
fFacetChecking
private boolean
fNormalize
private boolean
fNamespaces
private EntityState
fEntityState
private NamespaceContext
fNamespaceContext
private 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(com.sun.org.apache.xerces.internal.impl.validation.EntityState state)

        fEntityState = state;
    
public voidsetExtraChecking(boolean newValue)


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

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

        fNamespaceContext = namespace;
    
public voidsetNormalizationRequired(boolean newValue)

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

        fSymbolTable = sTable;
    
public voidsetUsingNamespaces(boolean newValue)

          fNamespaces = newValue;
    
public booleanuseNamespaces()

        return fNamespaces;