FileDocCategorySizeDatePackage
XSDocumentInfo.javaAPI DocJava SE 5 API9326Fri Aug 26 14:55:52 BST 2005com.sun.org.apache.xerces.internal.impl.xs.traversers

XSDocumentInfo

public class XSDocumentInfo extends Object

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 Document
fSchemaDoc
Vector
fImportedNS
protected ValidationState
fValidationContext
SymbolTable
fSymbolTable
protected XSAttributeChecker
fAttrChecker
protected Object[]
fSchemaAttrs
private Vector
fReportedTNS
Constructors Summary
XSDocumentInfo(Document schemaDoc, XSAttributeChecker attrChecker, SymbolTable symbolTable)


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

        fSymbolTable = symbolTable;
        fAttrChecker = attrChecker;

        if(schemaDoc != null) {
            Element root = DOMUtil.getRoot(schemaDoc);
            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);
    
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);
    
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;
    
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;