eu.cdevreeze.yaidom.simple

Node

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
Learn more about member selection
Visibility
  1. Public
  2. All

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. final def ==(arg0: AnyRef): Boolean

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

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

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

  8. def clone(): AnyRef

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

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

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

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

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

  14. def entityRef(entity: String): EntityRef

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  29. def toString(): String

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

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped