FileDocCategorySizeDatePackage
XSDocumentInfo.javaAPI DocJava SE 6 API7875Tue Jun 10 00:22:48 BST 2008com.sun.org.apache.xerces.internal.impl.xs.traversers

XSDocumentInfo

public class XSDocumentInfo extends Object
Objects of this class hold all information pecular to a particular XML Schema document. This is needed because namespace bindings and other settings on the element affect the contents of that schema document alone.
xerces.internal
author
Neil Graham, IBM
version
$Id: XSDocumentInfo.java,v 1.2.6.1 2005/09/09 07:26:33 sunithareddy Exp $

Fields Summary
protected SchemaNamespaceSupport
fNamespaceSupport
protected SchemaNamespaceSupport
fNamespaceSupportRoot
protected Stack
SchemaNamespaceSupportStack
protected boolean
fAreLocalAttributesQualified
protected boolean
fAreLocalElementsQualified
protected short
fBlockDefault
protected short
fFinalDefault
String
fTargetNamespace
protected boolean
fIsChameleonSchema
protected Element
fSchemaElement
Vector
fImportedNS
protected ValidationState
fValidationContext
SymbolTable
fSymbolTable
protected XSAttributeChecker
fAttrChecker
protected Object[]
fSchemaAttrs
protected XSAnnotationInfo
fAnnotations
private Vector
fReportedTNS
Constructors Summary
XSDocumentInfo(Element schemaRoot, XSAttributeChecker attrChecker, SymbolTable symbolTable)


    // note that the caller must ensure to call returnSchemaAttrs()
    // to avoid memory leaks!
          
                      
        fSchemaElement = schemaRoot;
        fNamespaceSupport = new SchemaNamespaceSupport();
        fNamespaceSupport.reset();
        fIsChameleonSchema = false;

        fSymbolTable = symbolTable;
        fAttrChecker = attrChecker;

        if (schemaRoot != null) {
            Element root = schemaRoot;
            fSchemaAttrs = attrChecker.checkAttributes(root, true, this);
            // schemaAttrs == null means it's not an <xsd:schema> element
            // throw an exception, but we don't know the document systemId,
            // so we leave that to the caller.
            if (fSchemaAttrs == null) {
                throw new XMLSchemaException(null, null);
            }
            fAreLocalAttributesQualified =
                ((XInt)fSchemaAttrs[XSAttributeChecker.ATTIDX_AFORMDEFAULT]).intValue() == SchemaSymbols.FORM_QUALIFIED;
            fAreLocalElementsQualified =
                ((XInt)fSchemaAttrs[XSAttributeChecker.ATTIDX_EFORMDEFAULT]).intValue() == SchemaSymbols.FORM_QUALIFIED;
            fBlockDefault =
                ((XInt)fSchemaAttrs[XSAttributeChecker.ATTIDX_BLOCKDEFAULT]).shortValue();
            fFinalDefault =
                ((XInt)fSchemaAttrs[XSAttributeChecker.ATTIDX_FINALDEFAULT]).shortValue();
            fTargetNamespace =
                (String)fSchemaAttrs[XSAttributeChecker.ATTIDX_TARGETNAMESPACE];
            if (fTargetNamespace != null)
                fTargetNamespace = symbolTable.addSymbol(fTargetNamespace);

            fNamespaceSupportRoot = new SchemaNamespaceSupport(fNamespaceSupport);

            //set namespace support
            fValidationContext.setNamespaceSupport(fNamespaceSupport);
            fValidationContext.setSymbolTable(symbolTable);
            // pass null as the schema document, so that the namespace
            // context is not popped.

            // don't return the attribute array yet!
            //attrChecker.returnAttrArray(schemaAttrs, null);
        }
    
Methods Summary
public voidaddAllowedNS(java.lang.String namespace)

        fImportedNS.addElement(namespace == null ? "" : namespace);
    
voidaddAnnotation(com.sun.org.apache.xerces.internal.impl.xs.traversers.XSAnnotationInfo info)

        info.next = fAnnotations;
        fAnnotations = info;
    
voidbackupNSSupport(com.sun.org.apache.xerces.internal.impl.xs.SchemaNamespaceSupport nsSupport)

        SchemaNamespaceSupportStack.push(fNamespaceSupport);
        if (nsSupport == null)
            nsSupport = fNamespaceSupportRoot;
        fNamespaceSupport = new SchemaNamespaceSupport(nsSupport);

        fValidationContext.setNamespaceSupport(fNamespaceSupport);
    
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSAnnotationInfogetAnnotations()

        return fAnnotations;
    
java.lang.Object[]getSchemaAttrs()

        return fSchemaAttrs;
    
public booleanisAllowedNS(java.lang.String namespace)

        return fImportedNS.contains(namespace == null ? "" : namespace);
    
final booleanneedReportTNSError(java.lang.String uri)

    // check whether we need to report an error against the given uri.
    // if we have reported an error, then we don't need to report again;
    // otherwise we reported the error, and remember this fact.
        
        if (fReportedTNS == null)
            fReportedTNS = new Vector();
        else if (fReportedTNS.contains(uri))
            return false;
        fReportedTNS.addElement(uri);
        return true;
    
voidremoveAnnotations()

        fAnnotations = null;
    
voidrestoreNSSupport()

        fNamespaceSupport = (SchemaNamespaceSupport)SchemaNamespaceSupportStack.pop();
        fValidationContext.setNamespaceSupport(fNamespaceSupport);
    
voidreturnSchemaAttrs()

        fAttrChecker.returnAttrArray (fSchemaAttrs, null);
        fSchemaAttrs = null;
    
public java.lang.StringtoString()

        return fTargetNamespace == null?"no targetNamspace":"targetNamespace is " + fTargetNamespace;