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