View Javadoc
1   /*
2    * reserved comment block
3    * DO NOT REMOVE OR ALTER!
4    */
5   /*
6    * Copyright 2002,2004,2005 The Apache Software Foundation.
7    *
8    * Licensed under the Apache License, Version 2.0 (the "License");
9    * you may not use this file except in compliance with the License.
10   * You may obtain a copy of the License at
11   *
12   *      http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS,
16   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   * See the License for the specific language governing permissions and
18   * limitations under the License.
19   */
20  
21  package com.sun.org.apache.xerces.internal.xni.grammars;
22  
23  import com.sun.org.apache.xerces.internal.xni.QName;
24  import com.sun.org.apache.xerces.internal.xni.XMLAttributes;
25  
26  /**
27   * All information specific to XML Schema grammars.
28   *
29   * @author Sandy Gao, IBM
30   *
31   */
32  public interface XMLSchemaDescription extends XMLGrammarDescription {
33  
34      // used to indicate what triggered the call
35      /**
36       * Indicate that the current schema document is <include>d by another
37       * schema document.
38       */
39      public final static short CONTEXT_INCLUDE   = 0;
40      /**
41       * Indicate that the current schema document is <redefine>d by another
42       * schema document.
43       */
44      public final static short CONTEXT_REDEFINE  = 1;
45      /**
46       * Indicate that the current schema document is <import>ed by another
47       * schema document.
48       */
49      public final static short CONTEXT_IMPORT    = 2;
50      /**
51       * Indicate that the current schema document is being preparsed.
52       */
53      public final static short CONTEXT_PREPARSE  = 3;
54      /**
55       * Indicate that the parse of the current schema document is triggered
56       * by xsi:schemaLocation/noNamespaceSchemaLocation attribute(s) in the
57       * instance document. This value is only used if we don't defer the loading
58       * of schema documents.
59       */
60      public final static short CONTEXT_INSTANCE  = 4;
61      /**
62       * Indicate that the parse of the current schema document is triggered by
63       * the occurrence of an element whose namespace is the target namespace
64       * of this schema document. This value is only used if we do defer the
65       * loading of schema documents until a component from that namespace is
66       * referenced from the instance.
67       */
68      public final static short CONTEXT_ELEMENT   = 5;
69      /**
70       * Indicate that the parse of the current schema document is triggered by
71       * the occurrence of an attribute whose namespace is the target namespace
72       * of this schema document. This value is only used if we do defer the
73       * loading of schema documents until a component from that namespace is
74       * referenced from the instance.
75       */
76      public final static short CONTEXT_ATTRIBUTE = 6;
77      /**
78       * Indicate that the parse of the current schema document is triggered by
79       * the occurrence of an "xsi:type" attribute, whose value (a QName) has
80       * the target namespace of this schema document as its namespace.
81       * This value is only used if we do defer the loading of schema documents
82       * until a component from that namespace is referenced from the instance.
83       */
84      public final static short CONTEXT_XSITYPE   = 7;
85  
86      /**
87       * Get the context. The returned value is one of the pre-defined
88       * CONTEXT_xxx constants.
89       *
90       * @return  the value indicating the context
91       */
92      public short getContextType();
93  
94      /**
95       * If the context is "include" or "redefine", then return the target
96       * namespace of the enclosing schema document; otherwise, the expected
97       * target namespace of this document.
98       *
99       * @return  the expected/enclosing target namespace
100      */
101     public String getTargetNamespace();
102 
103     /**
104      * For import and references from the instance document, it's possible to
105      * have multiple hints for one namespace. So this method returns an array,
106      * which contains all location hints.
107      *
108      * @return  an array of all location hints associated to the expected
109      *          target namespace
110      */
111     public String[] getLocationHints();
112 
113     /**
114      * If a call is triggered by an element/attribute/xsi:type in the instance,
115      * this call returns the name of such triggering component: the name of
116      * the element/attribute, or the value of the xsi:type.
117      *
118      * @return  the name of the triggering component
119      */
120     public QName getTriggeringComponent();
121 
122     /**
123      * If a call is triggered by an attribute or xsi:type, then this method
124      * returns the enclosing element of such element.
125      *
126      * @return  the name of the enclosing element
127      */
128     public QName getEnclosingElementName();
129 
130     /**
131      * If a call is triggered by an element/attribute/xsi:type in the instance,
132      * this call returns all attribute of such element (or enclosing element).
133      *
134      * @return  all attributes of the tiggering/enclosing element
135      */
136     public XMLAttributes getAttributes();
137 
138 } // XSDDescription