Package

eu.cdevreeze.yaidom

indexed

Permalink

package indexed

This package contains element representations that contain the "context" of the element. That is, the elements in this package are pairs of a root element and a path (to the actual element itself). The "context" of an element also contains an optional document URI.

An example of where such a representation can be useful is XML Schema. After all, to interpret an element definition in an XML schema, we need context of the element definition to determine the target namespace, or to determine whether the element definition is top level, etc.

Below follows a simple example query, using the uniform query API:

// Note the import of package indexed, and not of its members. That is indeed a best practice!
import eu.cdevreeze.yaidom.indexed

val indexedBookstoreElem = indexed.Elem(bookstoreElem)

val scalaBookAuthors =
  for {
    bookElem <- indexedBookstoreElem \ EName("{http://bookstore/book}Book")
    if (bookElem \@ EName("ISBN")) == Some("978-0981531649")
    authorElem <- bookElem \\ EName("{http://bookstore/author}Author")
  } yield authorElem

The query for Scala book authors would have been exactly the same if normal Elems had been used instead of indexed.Elems (replacing indexedBookstoreElem by bookstoreElem)!

There is no explicit functional update support for the indexed elements in this package. Of course the underlying elements can be functionally updated (for element implementations that offer such update support), and indexed elements can be created from the update results, but this is hardly efficient functional update support.

One problem with efficient functional updates for indexed elements is that updating just one child element means that all subsequent child elements may have to be updated as well, adapting the stored paths. In comparison, simple elements do not have this restriction, and can be updated in isolation. Hence the functional update support for simple elements but not for the different indexed element implementations.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. indexed
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Type Members

  1. abstract class AbstractIndexedClarkElem[U <: Aux[U]] extends queryapi.Nodes.Elem with IndexedClarkElemApi with ClarkElemLike

    Permalink

    Common super-class for IndexedClarkElem and IndexedScopedElem.

    Common super-class for IndexedClarkElem and IndexedScopedElem.

    U

    The underlying element type

  2. final class Document extends IndexedDocument with Immutable

    Permalink

    IndexedDocument, containing an "indexed" document element with simple elements as underlying elements.

  3. type Elem = indexed.IndexedScopedNode.Elem[simple.Elem]

    Permalink
  4. type IndexedClarkElem[U <: Aux[U]] = indexed.IndexedClarkNode.Elem[U]

    Permalink
  5. abstract class IndexedDocument extends DocumentApi with Immutable

    Permalink

    Document, containing an "indexed" document element.

    Document, containing an "indexed" document element.

    Note that class IndexedDocument does not have any query methods for Elem instances. In particular, the ElemApi does not apply to documents. Therefore, given a document, querying for elements (other than the document element itself) always goes via the document element.

  6. type IndexedScopedElem[U <: Aux[U]] = indexed.IndexedScopedNode.Elem[U]

    Permalink

Value Members

  1. object AbstractIndexedClarkElem

    Permalink
  2. object Document

    Permalink
  3. object Elem

    Permalink

    Factory object for Elem instances, where Elem is a type alias for IndexedScopedElem[simple.Elem].

  4. val IndexedClarkElem: indexed.IndexedClarkNode.Elem.type

    Permalink
  5. object IndexedClarkNode

    Permalink
  6. val IndexedScopedElem: indexed.IndexedScopedNode.Elem.type

    Permalink
  7. object IndexedScopedNode

    Permalink

Inherited from AnyRef

Inherited from Any

Ungrouped