public class TLcdOGCXPath extends Object implements ILcdCloneable
child::
, the abbreviated XPath axis specifier attribute::
and the abbreviated XPath axis specifier descendant-or-self::
are allowed.Person/spouse/@SIN
Person/phone[1]
//name
TLcdOGCXPath
is composed of a list of steps. Each step must have an XML qualified name (TLcdXMLName
), an axis specifier defined by this class constants and may have an optional predicate in the shape of
an Integer
.
An XML qualified name is composed of a name and a namespace.
Since each step has an XML qualified name, XML prefixes mechanism must be used to indicate the namespace of the
qualified name of the step.
e.g.
Geometry
refers to the default XML namespace (defined by xmlns="..."
).myns:Geometry
refers to the XML namespace associated to the myns prefix (defined by
xmlns:myns="..."
). ILcdXMLPrefixMap
,
TLcdXMLName
Modifier and Type | Field and Description |
---|---|
static String |
ATTRIBUTE_AXIS
The XPath axis specifier
attribute:: |
static String |
CHILD_AXIS
The XPath axis specifier
child:: |
static String |
DESCENDANT_OR_SELF_AXIS
The XPath axis specifier
descendant-or-self:: |
Constructor and Description |
---|
TLcdOGCXPath(String aPath,
ILcdXMLPrefixMap aPrefixMap)
Creates an instance by parsing the given XPath expression with a given prefix map.
|
TLcdOGCXPath(String aPath,
NamespaceContext aNamespaceContext)
Creates an instance by parsing the given XPath expression using the given namespace information.
|
TLcdOGCXPath(String aPath,
String aDefaultNamespace)
Creates an instance by parsing the given XPath expression with a given default namespace.
|
Modifier and Type | Method and Description |
---|---|
void |
addStep(TLcdXMLName aStepName,
String aAxis,
Object aPredicate)
Adds a new step to this instance.
|
Object |
clone()
Makes
Object.clone() public. |
boolean |
equals(Object obj) |
String |
getAxis(int aIndex)
Gets the step axis specifier for a given position.
|
Object |
getPredicate(int aIndex)
Gets the step predicate for a given position.
|
int |
getStepCount()
Gets the step count.
|
TLcdXMLName |
getStepName(int aIndex)
Gets the step name for a given position.
|
int |
hashCode() |
void |
removeStepAt(int aIndex)
Removes a step at a given position.
|
String |
toString() |
public static final String CHILD_AXIS
child::
public static final String ATTRIBUTE_AXIS
attribute::
public static final String DESCENDANT_OR_SELF_AXIS
descendant-or-self::
public TLcdOGCXPath(String aPath, String aDefaultNamespace)
aPath
- the XPath expression.aDefaultNamespace
- the default namespace that will be applied to all steps without prefixes.
The default name space shall not be null, since no prefix map is given.public TLcdOGCXPath(String aPath, ILcdXMLPrefixMap aPrefixMap)
aPath
- the XPath expression.aPrefixMap
- contains the namespaces associated to the prefixes that will be used in the
aPath
argument. The prefix map must not be null.public TLcdOGCXPath(String aPath, NamespaceContext aNamespaceContext)
aPath
- the XPath expression.aNamespaceContext
- contains the namespaces associated to the prefixes that will be used in the
aPath
argument. The context must not be null.public void addStep(TLcdXMLName aStepName, String aAxis, Object aPredicate)
aStepName
- an XML qualified nameaAxis
- an axis specifier defined by constants of this class.aPredicate
- either an child index in the shape of Integer
or null
.public void removeStepAt(int aIndex)
aIndex
- the index of the given position.public int getStepCount()
public TLcdXMLName getStepName(int aIndex)
aIndex
- the index of the given position.public Object getPredicate(int aIndex)
aIndex
- the index of the given position.public String getAxis(int aIndex)
aIndex
- the index of the given position.public Object clone()
ILcdCloneable
Makes Object.clone()
public.
java.lang.Object
, it can be implemented like this:
public Object clone() {
try {
return super.clone();
} catch ( CloneNotSupportedException e ) {
// Cannot happen: extends from Object and implements Cloneable (see also Object.clone)
throw new RuntimeException( e );
}
}
clone
in interface ILcdCloneable
clone
in class Object
Object.clone()