001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: package org.apache.xerces.xni.grammars;
019:
020: import org.apache.xerces.xni.QName;
021: import org.apache.xerces.xni.XMLAttributes;
022:
023: /**
024: * All information specific to XML Schema grammars.
025: *
026: * @author Sandy Gao, IBM
027: *
028: * @version $Id: XMLSchemaDescription.java 570134 2007-08-27 14:14:28Z mrglavas $
029: */
030: public interface XMLSchemaDescription extends XMLGrammarDescription {
031:
032: // used to indicate what triggered the call
033: /**
034: * Indicate that the current schema document is <include>d by another
035: * schema document.
036: */
037: public final static short CONTEXT_INCLUDE = 0;
038: /**
039: * Indicate that the current schema document is <redefine>d by another
040: * schema document.
041: */
042: public final static short CONTEXT_REDEFINE = 1;
043: /**
044: * Indicate that the current schema document is <import>ed by another
045: * schema document.
046: */
047: public final static short CONTEXT_IMPORT = 2;
048: /**
049: * Indicate that the current schema document is being preparsed.
050: */
051: public final static short CONTEXT_PREPARSE = 3;
052: /**
053: * Indicate that the parse of the current schema document is triggered
054: * by xsi:schemaLocation/noNamespaceSchemaLocation attribute(s) in the
055: * instance document. This value is only used if we don't defer the loading
056: * of schema documents.
057: */
058: public final static short CONTEXT_INSTANCE = 4;
059: /**
060: * Indicate that the parse of the current schema document is triggered by
061: * the occurrence of an element whose namespace is the target namespace
062: * of this schema document. This value is only used if we do defer the
063: * loading of schema documents until a component from that namespace is
064: * referenced from the instance.
065: */
066: public final static short CONTEXT_ELEMENT = 5;
067: /**
068: * Indicate that the parse of the current schema document is triggered by
069: * the occurrence of an attribute whose namespace is the target namespace
070: * of this schema document. This value is only used if we do defer the
071: * loading of schema documents until a component from that namespace is
072: * referenced from the instance.
073: */
074: public final static short CONTEXT_ATTRIBUTE = 6;
075: /**
076: * Indicate that the parse of the current schema document is triggered by
077: * the occurrence of an "xsi:type" attribute, whose value (a QName) has
078: * the target namespace of this schema document as its namespace.
079: * This value is only used if we do defer the loading of schema documents
080: * until a component from that namespace is referenced from the instance.
081: */
082: public final static short CONTEXT_XSITYPE = 7;
083:
084: /**
085: * Get the context. The returned value is one of the pre-defined
086: * CONTEXT_xxx constants.
087: *
088: * @return the value indicating the context
089: */
090: public short getContextType();
091:
092: /**
093: * If the context is "include" or "redefine", then return the target
094: * namespace of the enclosing schema document; otherwise, the expected
095: * target namespace of this document.
096: *
097: * @return the expected/enclosing target namespace
098: */
099: public String getTargetNamespace();
100:
101: /**
102: * For import and references from the instance document, it's possible to
103: * have multiple hints for one namespace. So this method returns an array,
104: * which contains all location hints.
105: *
106: * @return an array of all location hints associated to the expected
107: * target namespace
108: */
109: public String[] getLocationHints();
110:
111: /**
112: * If a call is triggered by an element/attribute/xsi:type in the instance,
113: * this call returns the name of such triggering component: the name of
114: * the element/attribute, or the value of the xsi:type.
115: *
116: * @return the name of the triggering component
117: */
118: public QName getTriggeringComponent();
119:
120: /**
121: * If a call is triggered by an attribute or xsi:type, then this method
122: * returns the enclosing element of such element.
123: *
124: * @return the name of the enclosing element
125: */
126: public QName getEnclosingElementName();
127:
128: /**
129: * If a call is triggered by an element/attribute/xsi:type in the instance,
130: * this call returns all attributes of such an element (or enclosing element).
131: *
132: * @return all attributes of the triggering/enclosing element
133: */
134: public XMLAttributes getAttributes();
135:
136: } // XSDDescription
|