1. /*
  2. * The Apache Software License, Version 1.1
  3. *
  4. *
  5. * Copyright (c) 2002 The Apache Software Foundation.
  6. * All rights reserved.
  7. *
  8. * Redistribution and use in source and binary forms, with or without
  9. * modification, are permitted provided that the following conditions
  10. * are met:
  11. *
  12. * 1. Redistributions of source code must retain the above copyright
  13. * notice, this list of conditions and the following disclaimer.
  14. *
  15. * 2. Redistributions in binary form must reproduce the above copyright
  16. * notice, this list of conditions and the following disclaimer in
  17. * the documentation and/or other materials provided with the
  18. * distribution.
  19. *
  20. * 3. The end-user documentation included with the redistribution,
  21. * if any, must include the following acknowledgment:
  22. * "This product includes software developed by the
  23. * Apache Software Foundation (http://www.apache.org/)."
  24. * Alternately, this acknowledgment may appear in the software itself,
  25. * if and wherever such third-party acknowledgments normally appear.
  26. *
  27. * 4. The names "Xerces" and "Apache Software Foundation" must
  28. * not be used to endorse or promote products derived from this
  29. * software without prior written permission. For written
  30. * permission, please contact apache@apache.org.
  31. *
  32. * 5. Products derived from this software may not be called "Apache",
  33. * nor may "Apache" appear in their name, without prior written
  34. * permission of the Apache Software Foundation.
  35. *
  36. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  37. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  38. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  39. * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  40. * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  41. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  42. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  43. * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  44. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  45. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  46. * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  47. * SUCH DAMAGE.
  48. * ====================================================================
  49. *
  50. * This software consists of voluntary contributions made by many
  51. * individuals on behalf of the Apache Software Foundation and was
  52. * originally based on software copyright (c) 1999, International
  53. * Business Machines, Inc., http://www.apache.org. For more
  54. * information on the Apache Software Foundation, please see
  55. * <http://www.apache.org/>.
  56. */
  57. package com.sun.org.apache.xerces.internal.xni.grammars;
  58. import com.sun.org.apache.xerces.internal.xni.QName;
  59. import com.sun.org.apache.xerces.internal.xni.XMLAttributes;
  60. /**
  61. * All information specific to XML Schema grammars.
  62. *
  63. * @author Sandy Gao, IBM
  64. *
  65. * @version $Id: XMLSchemaDescription.java,v 1.2 2003/11/14 16:54:05 mrglavas Exp $
  66. */
  67. public interface XMLSchemaDescription extends XMLGrammarDescription {
  68. // used to indicate what triggered the call
  69. /**
  70. * Indicate that the current schema document is <include>d by another
  71. * schema document.
  72. */
  73. public final static short CONTEXT_INCLUDE = 0;
  74. /**
  75. * Indicate that the current schema document is <redefine>d by another
  76. * schema document.
  77. */
  78. public final static short CONTEXT_REDEFINE = 1;
  79. /**
  80. * Indicate that the current schema document is <import>ed by another
  81. * schema document.
  82. */
  83. public final static short CONTEXT_IMPORT = 2;
  84. /**
  85. * Indicate that the current schema document is being preparsed.
  86. */
  87. public final static short CONTEXT_PREPARSE = 3;
  88. /**
  89. * Indicate that the parse of the current schema document is triggered
  90. * by xsi:schemaLocation/noNamespaceSchemaLocation attribute(s) in the
  91. * instance document. This value is only used if we don't defer the loading
  92. * of schema documents.
  93. */
  94. public final static short CONTEXT_INSTANCE = 4;
  95. /**
  96. * Indicate that the parse of the current schema document is triggered by
  97. * the occurrence of an element whose namespace is the target namespace
  98. * of this schema document. This value is only used if we do defer the
  99. * loading of schema documents until a component from that namespace is
  100. * referenced from the instance.
  101. */
  102. public final static short CONTEXT_ELEMENT = 5;
  103. /**
  104. * Indicate that the parse of the current schema document is triggered by
  105. * the occurrence of an attribute whose namespace is the target namespace
  106. * of this schema document. This value is only used if we do defer the
  107. * loading of schema documents until a component from that namespace is
  108. * referenced from the instance.
  109. */
  110. public final static short CONTEXT_ATTRIBUTE = 6;
  111. /**
  112. * Indicate that the parse of the current schema document is triggered by
  113. * the occurrence of an "xsi:type" attribute, whose value (a QName) has
  114. * the target namespace of this schema document as its namespace.
  115. * This value is only used if we do defer the loading of schema documents
  116. * until a component from that namespace is referenced from the instance.
  117. */
  118. public final static short CONTEXT_XSITYPE = 7;
  119. /**
  120. * Get the context. The returned value is one of the pre-defined
  121. * CONTEXT_xxx constants.
  122. *
  123. * @return the value indicating the context
  124. */
  125. public short getContextType();
  126. /**
  127. * If the context is "include" or "redefine", then return the target
  128. * namespace of the enclosing schema document; otherwise, the expected
  129. * target namespace of this document.
  130. *
  131. * @return the expected/enclosing target namespace
  132. */
  133. public String getTargetNamespace();
  134. /**
  135. * For import and references from the instance document, it's possible to
  136. * have multiple hints for one namespace. So this method returns an array,
  137. * which contains all location hints.
  138. *
  139. * @return an array of all location hints associated to the expected
  140. * target namespace
  141. */
  142. public String[] getLocationHints();
  143. /**
  144. * If a call is triggered by an element/attribute/xsi:type in the instance,
  145. * this call returns the name of such triggering component: the name of
  146. * the element/attribute, or the value of the xsi:type.
  147. *
  148. * @return the name of the triggering component
  149. */
  150. public QName getTriggeringComponent();
  151. /**
  152. * If a call is triggered by an attribute or xsi:type, then this mehtod
  153. * returns the enclosing element of such element.
  154. *
  155. * @return the name of the enclosing element
  156. */
  157. public QName getEnclosingElementName();
  158. /**
  159. * If a call is triggered by an element/attribute/xsi:type in the instance,
  160. * this call returns all attribute of such element (or enclosing element).
  161. *
  162. * @return all attributes of the tiggering/enclosing element
  163. */
  164. public XMLAttributes getAttributes();
  165. } // XSDDescription