Object

eu.cdevreeze.yaidom.indexed

IndexedClarkNode

Related Doc: package indexed

Permalink

object IndexedClarkNode

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. IndexedClarkNode
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. final class Elem[U <: Aux[_, U]] extends AbstractIndexedClarkElem[U] with Node

    Permalink

    An element within its context.

    An element within its context. In other words, an element as a pair containing the root element (of an underlying element type) and a path (from that root element) to this element. More precisely, this element implementation contains an underlying root element, a Path, and an underlying element found from the root element following the Path. It also contains an optional URI of the containing document, if any.

    See the documentation of the mixed-in query API trait(s) for more details on the uniform query API offered by this class.

    An IndexedClarkElem(underlyingRootElem) can be seen as one immutable snapshot of an XML tree. All queries (using the ElemApi uniform query API) on that snapshot return results within the same snapshot. Take care not to mix up query results from different snapshots. (This could have been modeled in an alternative design of the class, but such a design has not been chosen.)

    Using IndexedClarkElem objects, it is easy to get the ancestry or siblings of an element, as elements of the underlying element type.

    Be careful not to create any memory leaks. After all, an element, even a leaf element, typically keeps the entire underlying document element tree as state. Hence the underlying document element tree will always remain in memory if at least one indexed element contains it in its state. (Yet with mutable org.w3c.dom element trees, it is also easy to cause memory leaks. See http://apmblog.compuware.com/2011/04/20/the-top-java-memory-problems-part-1/.)

    The optional parent base URI is stored for very fast (optional) base URI computation. This is helpful in an XBRL context, where URI resolution against a base URI is typically a very frequent operation.

    IndexedClarkElem examples

    The following example code shows how to query for elements with a known ancestry, regardless of the element implementation, if efficiency is not important:

    val iBookstore = IndexedClarkElem(bookstore)
    
    val iTheBookAuthors =
      for {
        iAuthor <- iBookstore.filterElems(withLocalName("Author"))
        bookPath <- iAuthor.path.findAncestorPath(_.elementNameOption.map(_.localPart).contains("Book"))
        iBook <- iBookstore.findElem(_.path == bookPath)
        if iBook.getChildElem(withLocalName("Title")).elem.text.startsWith("Programming in Scala")
      } yield iAuthor

    IndexedClarkElem more formally

    In order to use this class, this more formal section can safely be skipped.

    The IndexedClarkElem class can be understood in a precise mathematical sense, as shown below.

    Some properties of IndexedClarkElems are as follows:

    // All elements (obtained from querying other elements) have the same rootElem
    
    iElem.findAllElemsOrSelf.map(_.rootElem).distinct == List(iElem.rootElem)
    
    iElem.findAllElemsOrSelf.map(_.underlyingRootElem).distinct == List(iElem.underlyingRootElem)
    
    // The correspondence between rootElem, path and elem
    
    iElem.findAllElemsOrSelf.forall(e => e.rootElem.findElemOrSelfByPath(e.path).get == e)
    
    iElem.findAllElemsOrSelf.forall(e => e.underlyingRootElem.findElemOrSelfByPath(e.path).get == e.underlyingElem)

    The correspondence between queries on IndexedClarkElems and the same queries on the underlying elements is as follows:

    // Let p be a function from underlying element type E to Boolean
    
    iElem.rootElem.filterElemsOrSelf(e => p(e.underlyingElem)).map(_.underlyingElem) ==
      iElem.underlyingRootElem.filterElemsOrSelf(p)

    Analogous properties hold for the other query methods.

  2. sealed trait Node extends resolved.ResolvedNodes.Node

    Permalink

    Node super-type of indexed Clark elements.

  3. final case class Text(text: String, isCData: Boolean) extends Node with resolved.ResolvedNodes.Text with Product with Serializable

    Permalink

Value Members

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

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. object Elem

    Permalink
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  9. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. final def getClass(): Class[_]

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

    Permalink
    Definition Classes
    AnyRef → Any
  12. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  13. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  14. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  15. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  16. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  17. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  18. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped