Object/Trait

eu.cdevreeze.yaidom.simple

Node

Related Docs: trait Node | package simple

Permalink

object Node extends Serializable

This singleton object contains a DSL to easily create deeply nested Elems. It looks a lot like the DSL for NodeBuilders, using the same method names (so a local import for Node singleton object members may be needed).

There is a catch, though. When using this DSL, scopes must be passed throughout the tree. These Scopes should typically be the same (or parent element scopes should be subscopes of child element scopes), because otherwise the corresponding XML may contain a lot of namespace undeclarations.

Another thing to watch out for is that the "tree representations" conform to the NodeBuilder DSL, not to this one.

In summary, the NodeBuilder DSL does have the advantage over this DSL that scopes do not have to be passed around. On the other hand, this Node DSL has the advantage that exceptions due to missing scope data are thrown immediately instead of later (when calling the build method, in the case of the NodeBuilder DSL).

For example:

import Node._

val scope = Scope.from("dbclass" -> "http://www.db-class.org")

elem(
  qname = QName("dbclass:Magazine"),
  attributes = Vector(QName("Month") -> "February", QName("Year") -> "2009"),
  scope = scope,
  children = Vector(
    elem(
      qname = QName("dbclass:Title"),
      scope = scope,
      children = Vector(text("Newsweek")))))

The latter expression could also be written as follows:

elem(
  qname = QName("dbclass:Magazine"),
  attributes = Vector(QName("Month") -> "February", QName("Year") -> "2009"),
  scope = scope,
  children = Vector(
    textElem(QName("dbclass:Title"), scope, "Newsweek")))
Linear Supertypes
Serializable, Serializable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Node
  2. Serializable
  3. Serializable
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

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. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def cdata(textValue: String): Text

    Permalink
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. def comment(textValue: String): Comment

    Permalink
  8. def elem(qname: QName, attributes: IndexedSeq[(QName, String)], scope: Scope, children: IndexedSeq[Node]): Elem

    Permalink
  9. def elem(qname: QName, scope: Scope, children: IndexedSeq[Node]): Elem

    Permalink
  10. def emptyElem(qname: QName, attributes: IndexedSeq[(QName, String)], scope: Scope): Elem

    Permalink
  11. def emptyElem(qname: QName, scope: Scope): Elem

    Permalink
  12. def entityRef(entity: String): EntityRef

    Permalink
  13. final def eq(arg0: AnyRef): Boolean

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

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

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

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

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

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

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

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

    Permalink
    Definition Classes
    AnyRef
  22. def processingInstruction(target: String, data: String): ProcessingInstruction

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

    Permalink
    Definition Classes
    AnyRef
  24. def text(textValue: String): Text

    Permalink
  25. def textElem(qname: QName, attributes: IndexedSeq[(QName, String)], scope: Scope, txt: String): Elem

    Permalink
  26. def textElem(qname: QName, scope: Scope, txt: String): Elem

    Permalink
  27. def toString(): String

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

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

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

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

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped