1. /*
  2. * Copyright 1999-2004 The Apache Software Foundation.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /*
  17. * $Id: Axis.java,v 1.5 2004/02/16 23:03:44 minchau Exp $
  18. */
  19. package com.sun.org.apache.xml.internal.dtm;
  20. /**
  21. * Specifies values related to XPath Axes.
  22. * <p>The ancestor, descendant, following, preceding and self axes partition a
  23. * document (ignoring attribute and namespace nodes): they do not overlap
  24. * and together they contain all the nodes in the document.</p>
  25. *
  26. */
  27. public interface Axis
  28. {
  29. /**
  30. * The ancestor axis contains the ancestors of the context node;
  31. * the ancestors of the context node consist of the parent of context
  32. * node and the parent's parent and so on; thus, the ancestor axis will
  33. * always include the root node, unless the context node is the root node.
  34. */
  35. public static final int ANCESTOR = 0;
  36. /**
  37. * the ancestor-or-self axis contains the context node and the ancestors of
  38. * the context node; thus, the ancestor axis will always include the
  39. * root node.
  40. */
  41. public static final int ANCESTORORSELF = 1;
  42. /**
  43. * the attribute axis contains the attributes of the context node; the axis
  44. * will be empty unless the context node is an element.
  45. */
  46. public static final int ATTRIBUTE = 2;
  47. /** The child axis contains the children of the context node. */
  48. public static final int CHILD = 3;
  49. /**
  50. * The descendant axis contains the descendants of the context node;
  51. * a descendant is a child or a child of a child and so on; thus the
  52. * descendant axis never contains attribute or namespace nodes.
  53. */
  54. public static final int DESCENDANT = 4;
  55. /**
  56. * The descendant-or-self axis contains the context node and the
  57. * descendants of the context node.
  58. */
  59. public static final int DESCENDANTORSELF = 5;
  60. /**
  61. * the following axis contains all nodes in the same document as the
  62. * context node that are after the context node in document order, excluding
  63. * any descendants and excluding attribute nodes and namespace nodes.
  64. */
  65. public static final int FOLLOWING = 6;
  66. /**
  67. * The following-sibling axis contains all the following siblings of the
  68. * context node; if the context node is an attribute node or namespace node,
  69. * the following-sibling axis is empty.
  70. */
  71. public static final int FOLLOWINGSIBLING = 7;
  72. /**
  73. * The namespace axis contains the namespace nodes of the context node; the
  74. * axis will be empty unless the context node is an element.
  75. */
  76. public static final int NAMESPACEDECLS = 8;
  77. /**
  78. * The namespace axis contains the namespace nodes of the context node; the
  79. * axis will be empty unless the context node is an element.
  80. */
  81. public static final int NAMESPACE = 9;
  82. /**
  83. * The parent axis contains the parent of the context node,
  84. * if there is one.
  85. */
  86. public static final int PARENT = 10;
  87. /**
  88. * The preceding axis contains all nodes in the same document as the context
  89. * node that are before the context node in document order, excluding any
  90. * ancestors and excluding attribute nodes and namespace nodes
  91. */
  92. public static final int PRECEDING = 11;
  93. /**
  94. * The preceding-sibling axis contains all the preceding siblings of the
  95. * context node; if the context node is an attribute node or namespace node,
  96. * the preceding-sibling axis is empty.
  97. */
  98. public static final int PRECEDINGSIBLING = 12;
  99. /** The self axis contains just the context node itself. */
  100. public static final int SELF = 13;
  101. /**
  102. * A non-xpath axis, traversing the subtree including the subtree
  103. * root, descendants, attributes, and namespace node decls.
  104. */
  105. public static final int ALLFROMNODE = 14;
  106. /**
  107. * A non-xpath axis, traversing the the preceding and the ancestor nodes,
  108. * needed for inverseing select patterns to match patterns.
  109. */
  110. public static final int PRECEDINGANDANCESTOR = 15;
  111. // ===========================================
  112. // All axis past this are absolute.
  113. /**
  114. * A non-xpath axis, returns all nodes in the tree from and including the
  115. * root.
  116. */
  117. public static final int ALL = 16;
  118. /**
  119. * A non-xpath axis, returns all nodes that aren't namespaces or attributes,
  120. * from and including the root.
  121. */
  122. public static final int DESCENDANTSFROMROOT = 17;
  123. /**
  124. * A non-xpath axis, returns all nodes that aren't namespaces or attributes,
  125. * from and including the root.
  126. */
  127. public static final int DESCENDANTSORSELFFROMROOT = 18;
  128. /**
  129. * A non-xpath axis, returns root only.
  130. */
  131. public static final int ROOT = 19;
  132. /**
  133. * A non-xpath axis, for functions.
  134. */
  135. public static final int FILTEREDLIST = 20;
  136. /** The names of the axes for diagnostic purposes. */
  137. public static final String[] names =
  138. {
  139. "ancestor", // 0
  140. "ancestor-or-self", // 1
  141. "attribute", // 2
  142. "child", // 3
  143. "descendant", // 4
  144. "descendant-or-self", // 5
  145. "following", // 6
  146. "following-sibling", // 7
  147. "namespace-decls", // 8
  148. "namespace", // 9
  149. "parent", // 10
  150. "preceding", // 11
  151. "preceding-sibling", // 12
  152. "self", // 13
  153. "all-from-node", // 14
  154. "preceding-and-ancestor", // 15
  155. "all", // 16
  156. "descendants-from-root", // 17
  157. "descendants-or-self-from-root", // 18
  158. "root", // 19
  159. "filtered-list" // 20
  160. };
  161. }