Class TLcdOGCXPath

java.lang.Object
com.luciad.ogc.filter.model.TLcdOGCXPath
All Implemented Interfaces:
ILcdCloneable, Cloneable

public class TLcdOGCXPath extends Object implements ILcdCloneable
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 specifier attribute:: and the abbreviated XPath axis specifier descendant-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.
e.g.
  • Person/spouse/@SIN
  • Person/phone[1]
  • //name
So a 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="...").
See Also:
  • Field Details

  • Constructor Details

    • TLcdOGCXPath

      public TLcdOGCXPath(String aPath, String aDefaultNamespace)
      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

      public TLcdOGCXPath(String aPath, ILcdXMLPrefixMap aPrefixMap)
      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 the aPath argument. The prefix map must not be null.
    • TLcdOGCXPath

      public TLcdOGCXPath(String aPath, NamespaceContext aNamespaceContext)
      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 the aPath argument. The context must not be null.
      Since:
      2017.0
  • Method Details

    • addStep

      public void addStep(TLcdXMLName aStepName, String aAxis, Object aPredicate)
      Adds a new step to this instance.
      Parameters:
      aStepName - an XML qualified name
      aAxis - an axis specifier defined by constants of this class.
      aPredicate - either an child index in the shape of Integer or null.
    • 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

      public TLcdXMLName getStepName(int aIndex)
      Gets the step name for a given position.
      Parameters:
      aIndex - the index of the given position.
      Returns:
      the step name.
    • getPredicate

      public Object getPredicate(int aIndex)
      Gets the step predicate for a given position.
      Parameters:
      aIndex - the index of the given position.
      Returns:
      the step predicate or null.
    • getAxis

      public String getAxis(int aIndex)
      Gets the step axis specifier for a given position.
      Parameters:
      aIndex - the index of the given position.
      Returns:
      the step axis specifier.
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • clone

      public Object clone()
      Description copied from interface: ILcdCloneable

      Makes Object.clone() public.

      When for example extending from 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 interface ILcdCloneable
      Overrides:
      clone in class Object
      See Also: