eu.cdevreeze.yaidom

ElemPath

final class ElemPath extends Immutable

Unique identification of a descendant (or self) Elem given a root Elem. It represents a unique path to an element, given a root element, independent of other types of nodes, as if the XML tree only consists of elements.

ElemPath instances are useful in certain queries (see eu.cdevreeze.yaidom.PathAwareElemLike), and in "functional updates" (see eu.cdevreeze.yaidom.UpdatableElemLike).

An eu.cdevreeze.yaidom.ElemPath corresponds to one and only one canonical path of the element (modulo prefix names), which is the corresponding (canonical) XPath expression. See http://ns.inria.org/active-tags/glossary/glossary.html#canonical-path. There is one catch, though. The ElemPath does not know the root element name, so that is not a part of the corresponding canonical XPath expression. See the documentation of method toCanonicalXPath.

The ElemPath contains an IndexedSeq of path entries for a specific child element, grandchild element etc., but the (root) element itself is referred to by an empty list of path entries.

As an alternative to class ElemPath, each element in a tree could be uniquely identified by "path entries" that only contained a child index instead of an element name plus element child index (of element children with the given name). Yet that would be far less easy to use. Hence ElemPath.Entry instances each contain an element name plus index.

Warning: indexing using ElemPaths can be slow, especially in large XML trees. Hence, it is advisable to use class ElemPath wisely in queries and "functional updates". Most queries for elements can be written without them (using the methods in trait ParentElemLike, instead of those added by subtrait PathAwareElemLike).

Self Type
ElemPath
Linear Supertypes
Immutable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. ElemPath
  2. Immutable
  3. AnyRef
  4. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new ElemPath(entries: IndexedSeq[Entry])

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. def ++(other: ElemPath): ElemPath

    Appends a given relative ElemPath to this ElemPath

  5. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  6. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  7. def ancestorOrSelfPaths: IndexedSeq[ElemPath]

    Returns the ancestor-or-self paths, starting with this path, then the parent (if any), and ending with the root path

  8. def ancestorPaths: IndexedSeq[ElemPath]

    Returns the ancestor paths, starting with the parent path (if any), and ending with the root path

  9. def append(entry: Entry): ElemPath

    Appends a given Entry to this ElemPath

  10. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  11. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  12. def containsName(ename: EName): Boolean

    Convenience method returning true if at least one entry has the given element name

  13. def endsWithName(ename: EName): Boolean

    Convenience method returning true if the last entry (if any) has the given element name

  14. val entries: IndexedSeq[Entry]

  15. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  16. def equals(obj: Any): Boolean

    Definition Classes
    ElemPath → AnyRef → Any
  17. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  18. def findAncestorOrSelfPath(p: (ElemPath) ⇒ Boolean): Option[ElemPath]

    Returns ancestorOrSelfPaths find { path => p(path) }

  19. def findAncestorPath(p: (ElemPath) ⇒ Boolean): Option[ElemPath]

    Returns ancestorPaths find { path => p(path) }

  20. def firstEntry: Entry

    Returns the first entry, if any, and throws an exception otherwise

  21. def firstEntryOption: Option[Entry]

    Returns the first entry, if any, wrapped in an Option

  22. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  23. def hashCode(): Int

    Definition Classes
    ElemPath → AnyRef → Any
  24. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  25. def isRoot: Boolean

    Returns true if this is the root ElemPath, so if it has no entries

  26. def lastEntry: Entry

    Returns the last entry, if any, and throws an exception otherwise

  27. def lastEntryOption: Option[Entry]

    Returns the last entry, if any, wrapped in an Option

  28. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  29. final def notify(): Unit

    Definition Classes
    AnyRef
  30. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  31. def parentPath: ElemPath

    Like parentPathOption, but unwrapping the result (or throwing an exception otherwise)

  32. def parentPathOption: Option[ElemPath]

    Gets the parent path (if any, because the root path has no parent) wrapped in an Option.

    Gets the parent path (if any, because the root path has no parent) wrapped in an Option.

    This method shows much of the reason why class ElemPath exists. If we know an element's ElemPath, and therefore its parent ElemPath (using this method), then we can obtain the parent element by following the parent path from the root of the tree.

  33. def prepend(entry: Entry): ElemPath

    Prepends a given Entry to this ElemPath

  34. def startsWithName(ename: EName): Boolean

    Convenience method returning true if the first entry (if any) has the given element name

  35. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  36. def toCanonicalXPath(scope: Scope): String

    Given an invertible Scope, returns the corresponding canonical XPath, but modified for the root element (which is unknown in the ElemPath).

    Given an invertible Scope, returns the corresponding canonical XPath, but modified for the root element (which is unknown in the ElemPath). The modification is that the root element is written as a slash followed by an asterisk.

    See http://ns.inria.org/active-tags/glossary/glossary.html#canonical-path.

  37. def toString(): String

    Definition Classes
    ElemPath → AnyRef → Any
  38. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  39. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  40. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  41. def withoutFirstEntry: ElemPath

    Like withoutFirstEntryOption, but unwrapping the result (or throwing an exception otherwise)

  42. def withoutFirstEntryOption: Option[ElemPath]

    Returns the ElemPath with the first path entry (if any) removed, wrapped in an Option.

Inherited from Immutable

Inherited from AnyRef

Inherited from Any

Ungrouped