de.fzi.XPath
Class Axis
java.lang.Object
|
+--de.fzi.XPath.Axis
- public final class Axis
- extends java.lang.Object
Class Axis
holds axis codes and provides two static functions,
getAxis
and getAxisName
which convert
axis name to integer code and vice versa.
Constructor Summary |
Axis()
|
Method Summary |
static int |
getAxis(java.lang.String axisname)
|
static java.lang.String |
getAxisName(int axis)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
INVALID
public static final int INVALID
- Invalid axis.
ANCESTOR
public static final int ANCESTOR
"ancestor"
axis.
ANCESTOR_OR_SELF
public static final int ANCESTOR_OR_SELF
"ancestor-or-self"
axis.
ATTRIBUTE
public static final int ATTRIBUTE
"attribute"
axis.
CHILD
public static final int CHILD
"child"
axis.
DESCENDANT
public static final int DESCENDANT
"descendant"
axis.
DESCENDANT_OR_SELF
public static final int DESCENDANT_OR_SELF
"descendant-or-self"
axis.
FOLLOWING
public static final int FOLLOWING
"following"
axis.
FOLLOWING_SIBLING
public static final int FOLLOWING_SIBLING
"following-sibling"
axis.
NAMESPACE
public static final int NAMESPACE
"namespace"
axis.
PARENT
public static final int PARENT
"parent"
axis.
PRECEDING
public static final int PRECEDING
"preceding"
axis.
PRECEDING_SIBLING
public static final int PRECEDING_SIBLING
"preceding-sibling"
axis.
SELF
public static final int SELF
"self"
axis.
Axis
public Axis()
getAxis
public static int getAxis(java.lang.String axisname)
- Parameters:
axisname
- name of the axis. should look like "axis::"
.
If axisname
is null
or not a valid axis name,
getAxis
returns INVALID
.
If axisname
is empty string, result is CHILD
axis.
If axisname
is "@"
, result is
ATTRIBUTE
axis.
TODO: implement both "axis::"
and "axis"
argument support.
- Returns:
- Returns integer axis code for a given
axisname
.
getAxisName
public static java.lang.String getAxisName(int axis)
- Parameters:
axis
- integer code of the axis.- Returns:
- Returns the string representation a given
axis
.
String representations are always
returned in full non-abbreviated form,
for example Axis.getAxisName(Axis.CHILD)
returns
"child"
.