1. /*
  2. * The Apache Software License, Version 1.1
  3. *
  4. *
  5. * Copyright (c) 1999 The Apache Software Foundation. All rights
  6. * 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 "Xalan" 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, Lotus
  53. * Development Corporation., http://www.lotus.com. For more
  54. * information on the Apache Software Foundation, please see
  55. * <http://www.apache.org/>.
  56. */
  57. package org.apache.xml.dtm;
  58. /**
  59. * Specifies values related to XPath Axes.
  60. * <p>The ancestor, descendant, following, preceding and self axes partition a
  61. * document (ignoring attribute and namespace nodes): they do not overlap
  62. * and together they contain all the nodes in the document.</p>
  63. */
  64. public interface Axis
  65. {
  66. /**
  67. * The ancestor axis contains the ancestors of the context node;
  68. * the ancestors of the context node consist of the parent of context
  69. * node and the parent's parent and so on; thus, the ancestor axis will
  70. * always include the root node, unless the context node is the root node.
  71. */
  72. public static final int ANCESTOR = 0;
  73. /**
  74. * the ancestor-or-self axis contains the context node and the ancestors of
  75. * the context node; thus, the ancestor axis will always include the
  76. * root node.
  77. */
  78. public static final int ANCESTORORSELF = 1;
  79. /**
  80. * the attribute axis contains the attributes of the context node; the axis
  81. * will be empty unless the context node is an element.
  82. */
  83. public static final int ATTRIBUTE = 2;
  84. /** The child axis contains the children of the context node. */
  85. public static final int CHILD = 3;
  86. /**
  87. * The descendant axis contains the descendants of the context node;
  88. * a descendant is a child or a child of a child and so on; thus the
  89. * descendant axis never contains attribute or namespace nodes.
  90. */
  91. public static final int DESCENDANT = 4;
  92. /**
  93. * The descendant-or-self axis contains the context node and the
  94. * descendants of the context node.
  95. */
  96. public static final int DESCENDANTORSELF = 5;
  97. /**
  98. * the following axis contains all nodes in the same document as the
  99. * context node that are after the context node in document order, excluding
  100. * any descendants and excluding attribute nodes and namespace nodes.
  101. */
  102. public static final int FOLLOWING = 6;
  103. /**
  104. * The following-sibling axis contains all the following siblings of the
  105. * context node; if the context node is an attribute node or namespace node,
  106. * the following-sibling axis is empty.
  107. */
  108. public static final int FOLLOWINGSIBLING = 7;
  109. /**
  110. * The namespace axis contains the namespace nodes of the context node; the
  111. * axis will be empty unless the context node is an element.
  112. */
  113. public static final int NAMESPACEDECLS = 8;
  114. /**
  115. * The namespace axis contains the namespace nodes of the context node; the
  116. * axis will be empty unless the context node is an element.
  117. */
  118. public static final int NAMESPACE = 9;
  119. /**
  120. * The parent axis contains the parent of the context node,
  121. * if there is one.
  122. */
  123. public static final int PARENT = 10;
  124. /**
  125. * The preceding axis contains all nodes in the same document as the context
  126. * node that are before the context node in document order, excluding any
  127. * ancestors and excluding attribute nodes and namespace nodes
  128. */
  129. public static final int PRECEDING = 11;
  130. /**
  131. * The preceding-sibling axis contains all the preceding siblings of the
  132. * context node; if the context node is an attribute node or namespace node,
  133. * the preceding-sibling axis is empty.
  134. */
  135. public static final int PRECEDINGSIBLING = 12;
  136. /** The self axis contains just the context node itself. */
  137. public static final int SELF = 13;
  138. /**
  139. * A non-xpath axis, traversing the subtree including the subtree
  140. * root, descendants, attributes, and namespace node decls.
  141. */
  142. public static final int ALLFROMNODE = 14;
  143. /**
  144. * A non-xpath axis, traversing the the preceding and the ancestor nodes,
  145. * needed for inverseing select patterns to match patterns.
  146. */
  147. public static final int PRECEDINGANDANCESTOR = 15;
  148. // ===========================================
  149. // All axis past this are absolute.
  150. /**
  151. * A non-xpath axis, returns all nodes in the tree from and including the
  152. * root.
  153. */
  154. public static final int ALL = 16;
  155. /**
  156. * A non-xpath axis, returns all nodes that aren't namespaces or attributes,
  157. * from and including the root.
  158. */
  159. public static final int DESCENDANTSFROMROOT = 17;
  160. /**
  161. * A non-xpath axis, returns all nodes that aren't namespaces or attributes,
  162. * from and including the root.
  163. */
  164. public static final int DESCENDANTSORSELFFROMROOT = 18;
  165. /**
  166. * A non-xpath axis, returns root only.
  167. */
  168. public static final int ROOT = 19;
  169. /**
  170. * A non-xpath axis, for functions.
  171. */
  172. public static final int FILTEREDLIST = 20;
  173. /** The names of the axes for diagnostic purposes. */
  174. public static final String[] names =
  175. {
  176. "ancestor", // 0
  177. "ancestor-or-self", // 1
  178. "attribute", // 2
  179. "child", // 3
  180. "descendant", // 4
  181. "descendant-or-self", // 5
  182. "following", // 6
  183. "following-sibling", // 7
  184. "namespace-decls", // 8
  185. "namespace", // 9
  186. "parent", // 10
  187. "preceding", // 11
  188. "preceding-sibling", // 12
  189. "self", // 13
  190. "all-from-node", // 14
  191. "preceding-and-ancestor", // 15
  192. "all", // 16
  193. "descendants-from-root", // 17
  194. "descendants-or-self-from-root", // 18
  195. "root", // 19
  196. "filtered-list" // 20
  197. };
  198. }