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.
- Alphabetic
- By Inheritance
- XPathElem
- ElemLike
- ElemApi
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def filterElems(p: (XPathElem) => Boolean): IndexedSeq[XPathElem]
Finds all descendant elements obeying the given predicate.
- 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.
- final def filterElemsOrSelf(p: (XPathElem) => Boolean): IndexedSeq[XPathElem]
Finds all descendant-or-self elements obeying the given predicate.
- 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.
- final def findAllElems: IndexedSeq[XPathElem]
Finds all descendant elements.
- final def findAllElemsOfType[A <: XPathElem](cls: ClassTag[A]): IndexedSeq[A]
Finds all descendant elements of the given element type.
- final def findAllElemsOrSelf: IndexedSeq[XPathElem]
Finds all descendant-or-self elements.
- final def findAllElemsOrSelfOfType[A <: XPathElem](cls: ClassTag[A]): IndexedSeq[A]
Finds all descendant-or-self elements of the given element type.
- final def findAllTopmostElemsOfType[A <: XPathElem](cls: ClassTag[A]): IndexedSeq[A]
Finds all topmost descendant elements of the given element type.
- final def findAllTopmostElemsOrSelfOfType[A <: XPathElem](cls: ClassTag[A]): IndexedSeq[A]
Finds all topmost descendant-or-self elements of the given element type.
- final def findElem(p: (XPathElem) => Boolean): Option[XPathElem]
Finds the first descendant element obeying the given predicate, if any, returning an optional result.
- 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.
- 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.
- 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.
- 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.
- 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.
- final def findTopmostElems(p: (XPathElem) => Boolean): IndexedSeq[XPathElem]
Finds all topmost descendant elements obeying the given predicate.
- 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.
- final def findTopmostElemsOrSelf(p: (XPathElem) => Boolean): IndexedSeq[XPathElem]
Finds all topmost elements-or-self obeying the given predicate.
- 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.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated