Packages

sealed trait XPathElem extends ElemLike[XPathElem]

XPath 3.1 AST. The root of the type hierarchy is XPathElem. It offers the ElemApi query API.

The requirements on this AST are as follows:

  • It must represent the syntax tree of a successfully parsed XPath expression
  • It is not annotated with more semantic information, like type information that is not included in the XPath expression
  • It does not know anything about the context in which it runs, like bound namespaces etc.
  • It is rich enough to be able to serialize the AST back to XPath, knowing exactly where to place parentheses, braces, etc.
  • It should help evaluation, so it should model operator associativity and precedence correctly, where feasible
  • It must be readable in that object composition trees are not unnecessarily deep and therefore hard to comprehend
  • Serialization of the AST to XPath may lead to differences in whitespace (and operator aliases), but other than that the result must be the same
  • The AST class hierarchy does not have to use the exact same names as the XPath grammar
  • Instances of the AST classes are easy to create in an ad-hoc manner, so they contain no parsing state
  • The AST classes are case classes, with value equality and good support for pattern matching

It would be natural for the AST types to have IS-A relationships modeled as type inheritance, and HAS-A relationships modeled as composition. Where feasible, this approach has been followed. Consequently, sealed trait inheritance has been used a lot (IS-A instead of HAS-A), and unnecessarily deep object trees are prevented in this way.

Having such an AST of a successfully parsed XPath expression, it must be easy to reliably find used namespace prefixes, for example.

The AST, as well as the parser, were developed using the XPath 3.1 specification as input. In particular, see https://www.w3.org/TR/xpath-31/#id-grammar and https://www.w3.org/TR/xpath-31/#id-precedence-order. Note that the grammar in isolation does not clearly convey left or right associativity of operators, so the extra information about operator precedence and associativity is essential for understanding the "structure" of compound expressions.

TODO Improve several class names.

Linear Supertypes
Known Subclasses
AbbrevForwardStep, AbbrevReverseStep, AdditionOp, Minus, Plus, AdditiveExpr, AndExpr, AnyArrayTest, AnyAttributeTest, AnyElementTest, AnyFunctionTest, AnyItemType, AnyKindTest, AnyMapTest, AnyWildcard, Argument, ArgumentList, ArgumentPlaceholder, ArrayConstructor, ArrayTest, ArrowExpr, ArrowFunctionCall, ArrowFunctionSpecifier, AtomicOrUnionType, AttributeAxisAbbrevForwardStep, AttributeNameAndTypeTest, AttributeNameTest, AttributeTest, AttributeTypeTest, AxisStep, CastExpr, CastableExpr, CommentTest, Comp, ComparisonExpr, CompoundAdditiveExpr, CompoundAndExpr, CompoundArrowExpr, CompoundCastExpr, CompoundCastableExpr, CompoundComparisonExpr, CompoundExpr, CompoundInstanceOfExpr, CompoundIntersectExceptExpr, CompoundMultiplicativeExpr, CompoundOrExpr, CompoundPostfixExpr, CompoundRangeExpr, CompoundRelativePathExpr, CompoundSimpleMapExpr, CompoundStringConcatExpr, CompoundTreatExpr, CompoundUnaryExpr, CompoundUnionExpr, ContextItemExpr, CurlyArrayConstructor, DataPITest, DecimalLiteral, DocumentTest, DocumentTestContainingElementTest, DocumentTestContainingSchemaElementTest, DoubleLiteral, EQNameAsArrowFunctionSpecifier, ElementNameAndTypeTest, ElementNameTest, ElementTest, ElementTypeTest, EmptySequenceType, EnclosedExpr, ExactlyOneSequenceType, Expr, ExprSingle, ExprSingleArgument, ForExpr, ForwardAxis, Attribute, Child, Descendant, DescendantOrSelf, Following, FollowingSibling, Namespace, Self, ForwardAxisStep, ForwardStep, FunctionCall, FunctionItemExpr, FunctionTest, GeneralComp, Eq, Ge, Gt, Le, Lt, Ne, IfExpr, InlineFunctionExpr, InstanceOfExpr, IntegerLiteral, IntersectExceptExpr, IntersectExceptOp, Except, Intersect, ItemType, KeySpecifier, KindTest, KindTestItemType, LeafElem, LetExpr, Literal, LocalNameWildcard, MapConstructor, MapConstructorEntry, MapTest, MultiplicativeExpr, MultiplicativeOp, Div, IDiv, Mod, Times, NameTest, NamedFunctionRef, NamedKeySpecifier, NamespaceNodeTest, NamespaceWildcard, NillableElementNameAndTypeTest, NillableElementTypeTest, NodeComp, Follows, Is, Precedes, NodeTest, NonAbbrevForwardStep, NonAbbrevReverseStep, NonEmptySingleType, NumericLiteral, OneOrMoreSequenceType, OrExpr, PITest, Param, ParamList, ParenthesizedExpr, ParenthesizedExprAsArrowFunctionSpecifier, ParenthesizedExprKeySpecifier, ParenthesizedItemType, PathExpr, PathExprStartingWithDoubleSlash, PathExprStartingWithSingleSlash, PositionalKeySpecifier, Postfix, PostfixExpr, PostfixLookup, PotentiallyEmptySingleType, Predicate, PrefixWildcard, PrimaryExpr, QuantifiedExpr, Quantifier, EveryQuantifier, SomeQuantifier, RangeExpr, RelativePathExpr, ReverseAxis, Ancestor, AncestorOrSelf, Parent, Preceding, PrecedingSibling, ReverseAxisStep, ReverseStep, SchemaAttributeTest, SchemaElementTest, SequenceType, SimpleAbbrevForwardStep, SimpleAdditiveExpr, SimpleAndExpr, SimpleArrowExpr, SimpleBindingInQuantifiedExpr, SimpleCastExpr, SimpleCastableExpr, SimpleComparisonExpr, SimpleDocumentTest, SimpleExpr, SimpleForBinding, SimpleInstanceOfExpr, SimpleIntersectExceptExpr, SimpleLetBinding, SimpleMapExpr, SimpleMultiplicativeExpr, SimpleNameTest, SimpleOrExpr, SimplePITest, SimplePostfixExpr, SimpleRangeExpr, SimpleRelativePathExpr, SimpleSimpleMapExpr, SimpleStringConcatExpr, SimpleTreatExpr, SimpleUnaryExpr, SimpleUnionExpr, SingleType, SlashOnlyPathExpr, SquareArrayConstructor, StepExpr, StepOp, DoubleSlash, SingleSlash, StringConcatExpr, StringLiteral, TargetPITest, TextTest, TreatExpr, TypeDeclaration, TypedArrayTest, TypedFunctionTest, TypedMapTest, UnaryExpr, UnaryLookup, UnaryOp, Minus, Plus, UnionExpr, ValueComp, Eq, Ge, Gt, Le, Lt, Ne, ValueExpr, VarRef, VarRefAsArrowFunctionSpecifier, VariableBinding, VariableIntroducingExpr, Wildcard, WildcardKeySpecifier, XPathExpr, ZeroOrMoreSequenceType, ZeroOrOneSequenceType
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. XPathElem
  2. ElemLike
  3. ElemApi
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Abstract Value Members

  1. abstract def children: IndexedSeq[XPathElem]

    Returns the (immediate) child elements of this element.

    Returns the (immediate) child elements of this element.

    Definition Classes
    XPathElemElemLikeElemApi

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  8. final def filterElems(p: (XPathElem) => Boolean): IndexedSeq[XPathElem]

    Finds all descendant elements obeying the given predicate.

    Finds all descendant elements obeying the given predicate.

    Definition Classes
    ElemLikeElemApi
  9. final def filterElemsOfType[A <: XPathElem](cls: ClassTag[A])(p: (A) => Boolean): IndexedSeq[A]

    Finds all descendant elements of the given element type obeying the given predicate.

    Finds all descendant elements of the given element type obeying the given predicate.

    Definition Classes
    ElemLikeElemApi
  10. final def filterElemsOrSelf(p: (XPathElem) => Boolean): IndexedSeq[XPathElem]

    Finds all descendant-or-self elements obeying the given predicate.

    Finds all descendant-or-self elements obeying the given predicate. This is a core method in that several methods are implemented directly or indirectly in terms of this one.

    Definition Classes
    ElemLikeElemApi
  11. final def filterElemsOrSelfOfType[A <: XPathElem](cls: ClassTag[A])(p: (A) => Boolean): IndexedSeq[A]

    Finds all descendant-or-self elements of the given element type obeying the given predicate.

    Finds all descendant-or-self elements of the given element type obeying the given predicate.

    Definition Classes
    ElemLikeElemApi
  12. final def findAllElems: IndexedSeq[XPathElem]

    Finds all descendant elements.

    Finds all descendant elements.

    Definition Classes
    ElemLikeElemApi
  13. final def findAllElemsOfType[A <: XPathElem](cls: ClassTag[A]): IndexedSeq[A]

    Finds all descendant elements of the given element type.

    Finds all descendant elements of the given element type.

    Definition Classes
    ElemLikeElemApi
  14. final def findAllElemsOrSelf: IndexedSeq[XPathElem]

    Finds all descendant-or-self elements.

    Finds all descendant-or-self elements.

    Definition Classes
    ElemLikeElemApi
  15. final def findAllElemsOrSelfOfType[A <: XPathElem](cls: ClassTag[A]): IndexedSeq[A]

    Finds all descendant-or-self elements of the given element type.

    Finds all descendant-or-self elements of the given element type.

    Definition Classes
    ElemLikeElemApi
  16. final def findAllTopmostElemsOfType[A <: XPathElem](cls: ClassTag[A]): IndexedSeq[A]

    Finds all topmost descendant elements of the given element type.

    Finds all topmost descendant elements of the given element type.

    Definition Classes
    ElemLikeElemApi
  17. final def findAllTopmostElemsOrSelfOfType[A <: XPathElem](cls: ClassTag[A]): IndexedSeq[A]

    Finds all topmost descendant-or-self elements of the given element type.

    Finds all topmost descendant-or-self elements of the given element type.

    Definition Classes
    ElemLikeElemApi
  18. final def findElem(p: (XPathElem) => Boolean): Option[XPathElem]

    Finds the first descendant element obeying the given predicate, if any, returning an optional result.

    Finds the first descendant element obeying the given predicate, if any, returning an optional result.

    Definition Classes
    ElemLikeElemApi
  19. final def findElemOfType[A <: XPathElem](cls: ClassTag[A])(p: (A) => Boolean): Option[A]

    Finds the first descendant element of the given element type obeying the given predicate, if any, returning an optional result.

    Finds the first descendant element of the given element type obeying the given predicate, if any, returning an optional result.

    Definition Classes
    ElemLikeElemApi
  20. final def findElemOrSelf(p: (XPathElem) => Boolean): Option[XPathElem]

    Finds the first descendant-or-self element obeying the given predicate, if any, returning an optional result.

    Finds the first descendant-or-self element obeying the given predicate, if any, returning an optional result.

    Definition Classes
    ElemLikeElemApi
  21. final def findElemOrSelfOfType[A <: XPathElem](cls: ClassTag[A])(p: (A) => Boolean): Option[A]

    Finds the first descendant-or-self element of the given element type obeying the given predicate, if any, returning an optional result.

    Finds the first descendant-or-self element of the given element type obeying the given predicate, if any, returning an optional result.

    Definition Classes
    ElemLikeElemApi
  22. final def findFirstElemOfType[A <: XPathElem](cls: ClassTag[A]): Option[A]

    Finds the first descendant element of the given element type, if any, returning an optional result.

    Finds the first descendant element of the given element type, if any, returning an optional result.

    Definition Classes
    ElemLikeElemApi
  23. final def findFirstElemOrSelfOfType[A <: XPathElem](cls: ClassTag[A]): Option[A]

    Finds the first descendant-or-self element of the given element type, if any, returning an optional result.

    Finds the first descendant-or-self element of the given element type, if any, returning an optional result.

    Definition Classes
    ElemLikeElemApi
  24. final def findTopmostElems(p: (XPathElem) => Boolean): IndexedSeq[XPathElem]

    Finds all topmost descendant elements obeying the given predicate.

    Finds all topmost descendant elements obeying the given predicate.

    Definition Classes
    ElemLikeElemApi
  25. final def findTopmostElemsOfType[A <: XPathElem](cls: ClassTag[A])(p: (A) => Boolean): IndexedSeq[A]

    Finds all topmost descendant elements of the given element type obeying the given predicate.

    Finds all topmost descendant elements of the given element type obeying the given predicate.

    Definition Classes
    ElemLikeElemApi
  26. final def findTopmostElemsOrSelf(p: (XPathElem) => Boolean): IndexedSeq[XPathElem]

    Finds all topmost elements-or-self obeying the given predicate.

    Finds all topmost elements-or-self obeying the given predicate. This is a core method in that several methods are implemented directly or indirectly in terms of this one.

    Definition Classes
    ElemLikeElemApi
  27. final def findTopmostElemsOrSelfOfType[A <: XPathElem](cls: ClassTag[A])(p: (A) => Boolean): IndexedSeq[A]

    Finds all topmost descendant-or-self elements of the given element type obeying the given predicate.

    Finds all topmost descendant-or-self elements of the given element type obeying the given predicate.

    Definition Classes
    ElemLikeElemApi
  28. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  29. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  30. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  31. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  32. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  33. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  34. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  35. def toString(): String
    Definition Classes
    AnyRef → Any
  36. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  37. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  38. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from ElemLike[XPathElem]

Inherited from ElemApi[XPathElem]

Inherited from AnyRef

Inherited from Any

Ungrouped