Package com.luciad.ogc.filter.model
Class TLcdOGCXPath
java.lang.Object
com.luciad.ogc.filter.model.TLcdOGCXPath
- All Implemented Interfaces:
ILcdCloneable
,Cloneable
This class represents an XPath expression as defined in the OGC filter specification.
This XPath expression is in fact a subset of the XPath expression defined by the W3C consortium.
The following restrictions apply :
- Only relative paths are allowed.
- Only the abbreviated XPath axis specifier
child::
, the abbreviated XPath axis specifierattribute::
and the abbreviated XPath axis specifierdescendant-or-self::
are allowed. - Only integers are allowed as predicates. (indicating the index of the child element). Note that predicates start at 1 and not at 0.
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 byxmlns="..."
).myns:Geometry
refers to the XML namespace associated to the myns prefix (defined byxmlns:myns="..."
).
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionTLcdOGCXPath
(String aPath, ILcdXMLPrefixMap aPrefixMap) Creates an instance by parsing the given XPath expression with a given prefix map.TLcdOGCXPath
(String aPath, String aDefaultNamespace) Creates an instance by parsing the given XPath expression with a given default namespace.TLcdOGCXPath
(String aPath, NamespaceContext aNamespaceContext) Creates an instance by parsing the given XPath expression using the given namespace information. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addStep
(TLcdXMLName aStepName, String aAxis, Object aPredicate) Adds a new step to this instance.clone()
MakesObject.clone()
public.boolean
getAxis
(int aIndex) Gets the step axis specifier for a given position.getPredicate
(int aIndex) Gets the step predicate for a given position.int
Gets the step count.getStepName
(int aIndex) Gets the step name for a given position.int
hashCode()
void
removeStepAt
(int aIndex) Removes a step at a given position.toString()
-
Field Details
-
CHILD_AXIS
The XPath axis specifierchild::
- See Also:
-
ATTRIBUTE_AXIS
The XPath axis specifierattribute::
- See Also:
-
DESCENDANT_OR_SELF_AXIS
The XPath axis specifierdescendant-or-self::
- See Also:
-
-
Constructor Details
-
TLcdOGCXPath
Creates an instance by parsing the given XPath expression with a given default namespace.- Parameters:
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.
-
TLcdOGCXPath
Creates an instance by parsing the given XPath expression with a given prefix map.- Parameters:
aPath
- the XPath expression.aPrefixMap
- contains the namespaces associated to the prefixes that will be used in theaPath
argument. The prefix map must not be null.
-
TLcdOGCXPath
Creates an instance by parsing the given XPath expression using the given namespace information.- Parameters:
aPath
- the XPath expression.aNamespaceContext
- contains the namespaces associated to the prefixes that will be used in theaPath
argument. The context must not be null.- Since:
- 2017.0
-
-
Method Details
-
addStep
Adds a new step to this instance.- Parameters:
aStepName
- an XML qualified nameaAxis
- an axis specifier defined by constants of this class.aPredicate
- either an child index in the shape ofInteger
ornull
.
-
removeStepAt
public void removeStepAt(int aIndex) Removes a step at a given position.- Parameters:
aIndex
- the index of the given position.
-
getStepCount
public int getStepCount()Gets the step count.- Returns:
- the step count.
-
getStepName
Gets the step name for a given position.- Parameters:
aIndex
- the index of the given position.- Returns:
- the step name.
-
getPredicate
Gets the step predicate for a given position.- Parameters:
aIndex
- the index of the given position.- Returns:
- the step predicate or null.
-
getAxis
Gets the step axis specifier for a given position.- Parameters:
aIndex
- the index of the given position.- Returns:
- the step axis specifier.
-
equals
-
hashCode
public int hashCode() -
toString
-
clone
Description copied from interface:ILcdCloneable
Makes
When for example extending fromObject.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 ); } }
- Specified by:
clone
in interfaceILcdCloneable
- Overrides:
clone
in classObject
- See Also:
-