XSDocumentInfopublic 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. |
Fields Summary |
---|
protected org.apache.xerces.impl.xs.SchemaNamespaceSupport | fNamespaceSupport | protected org.apache.xerces.impl.xs.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 org.apache.xerces.impl.validation.ValidationState | fValidationContext | org.apache.xerces.util.SymbolTable | fSymbolTable | protected XSAttributeChecker | fAttrChecker | protected Object[] | fSchemaAttrs | protected XSAnnotationInfo | fAnnotations | private Vector | fReportedTNS |
Constructors Summary |
---|
XSDocumentInfo(Element schemaRoot, XSAttributeChecker attrChecker, org.apache.xerces.util.SymbolTable symbolTable)
// note that the caller must ensure to call returnSchemaAttrs()
// to avoid memory leaks!
fSchemaElement = schemaRoot;
fNamespaceSupport = new SchemaNamespaceSupport(schemaRoot, symbolTable);
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 void | addAllowedNS(java.lang.String namespace)
fImportedNS.addElement(namespace == null ? "" : namespace);
| void | addAnnotation(XSAnnotationInfo info)
info.next = fAnnotations;
fAnnotations = info;
| void | backupNSSupport(org.apache.xerces.impl.xs.SchemaNamespaceSupport nsSupport)
SchemaNamespaceSupportStack.push(fNamespaceSupport);
if (nsSupport == null)
nsSupport = fNamespaceSupportRoot;
fNamespaceSupport = new SchemaNamespaceSupport(nsSupport);
fValidationContext.setNamespaceSupport(fNamespaceSupport);
| XSAnnotationInfo | getAnnotations()
return fAnnotations;
| java.lang.Object[] | getSchemaAttrs()
return fSchemaAttrs;
| public boolean | isAllowedNS(java.lang.String namespace)
return fImportedNS.contains(namespace == null ? "" : namespace);
| final boolean | needReportTNSError(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;
| void | removeAnnotations()
fAnnotations = null;
| void | restoreNSSupport()
fNamespaceSupport = (SchemaNamespaceSupport)SchemaNamespaceSupportStack.pop();
fValidationContext.setNamespaceSupport(fNamespaceSupport);
| void | returnSchemaAttrs()
fAttrChecker.returnAttrArray (fSchemaAttrs, null);
fSchemaAttrs = null;
| public java.lang.String | toString()
return fTargetNamespace == null?"no targetNamspace":"targetNamespace is " + fTargetNamespace;
|
|