Shorthand for filterChildElems(p)
.
Shorthand for filterElemsOrSelf(p)
.
Shorthand for findTopmostElemsOrSelf(p)
.
Returns true if all namespace declarations, if any, are only at top level (so at the root of this tree).
Returns true if all namespace declarations, if any, are only at top level (so at the root of this tree).
It is good practice for a complete ElemBuilder
tree to have only top-level namespace declarations, if any.
The attributes of the element as mapping from QNames to values
The attributes of the element as mapping from QNames to values
Creates an Elem
from this element builder, using the passed parent scope.
Creates an Elem
from this element builder, using the passed parent scope.
The Scope
of the created (root) element is the passed parent scope, altered by the namespace declarations
in this element builder, if any.
Returns build(Scope.Empty)
Returns build(Scope.Empty)
Returns true if parentScope suffices to build an Elem
, that is, if build(parentScope)
returns an Elem
instead of
throwing an exception.
Returns true if parentScope suffices to build an Elem
, that is, if build(parentScope)
returns an Elem
instead of
throwing an exception.
A complete ElemBuilder
tree should obey property canBuild(Scope.Empty)
.
Creates a copy, altered with the explicitly passed parameters (for qname, attributes, namespaces and children).
Returns the child elements obeying the given predicate.
Returns the descendant elements obeying the given predicate.
Returns the descendant-or-self elements obeying the given predicate.
Returns the descendant-or-self elements obeying the given predicate. This method could be defined as:
def filterElemsOrSelf(p: E => Boolean): immutable.IndexedSeq[E] = Vector(this).filter(p) ++ (this.findAllChildElems flatMap (_.filterElemsOrSelf(p)))
It can be proven that the result is equivalent to findAllElemsOrSelf filter p
.
Returns the element children as ElemBuilder instances
Returns the element children as ElemBuilder instances
Returns all descendant elements (not including this element).
Returns this element followed by all descendant elements (that is, the descendant-or-self elements).
Returns the first found child element obeying the given predicate, if any, wrapped in an Option
.
Returns the first found (topmost) descendant element obeying the given predicate, if any, wrapped in an Option
.
Returns the first found (topmost) descendant-or-self element obeying the given predicate, if any, wrapped in an Option
.
Returns the descendant elements obeying the given predicate that have no ancestor obeying the predicate.
Returns the descendant-or-self elements obeying the given predicate, such that no ancestor obeys the predicate.
Returns the descendant-or-self elements obeying the given predicate, such that no ancestor obeys the predicate. This method could be defined as:
def findTopmostElemsOrSelf(p: E => Boolean): immutable.IndexedSeq[E] = if (p(this)) Vector(this) else (this.findAllChildElems flatMap (_.findTopmostElemsOrSelf(p)))
Returns the single child element obeying the given predicate, and throws an exception otherwise.
Returns the accumulated used but non-declared prefixes throughout the tree, given the passed parentScope.
Returns the accumulated used but non-declared prefixes throughout the tree, given the passed parentScope. A prefix is considered used in an element if it is used in element name and/or attribute names.
Returns XmlStringUtils.normalizeString(text)
.
Returns XmlStringUtils.normalizeString(text)
.
Returns withChildren(self.children :+ newChild)
.
The QName of the element
The QName of the element
Returns the concatenation of the texts of text children, including whitespace and CData.
Returns the concatenation of the texts of text children, including whitespace and CData. Non-text children are ignored. If there are no text children, the empty string is returned.
Returns the text children
Returns toTreeRepr
.
Returns toTreeRepr
.
Returns the tree representation.
Returns the tree representation. See the corresponding method in eu.cdevreeze.yaidom.simple.Node.
Returns the same element, except that child elements have been replaced by applying the given function.
Returns the same element, except that child elements have been replaced by applying the given function. Non-element child nodes occur in the result element unaltered.
That is, returns the equivalent of:
val newChildren = children map { case e: E => f(e) case n: N => n } withChildren(newChildren)
Returns the same element, except that child elements have been replaced by applying the given function.
Returns the same element, except that child elements have been replaced by applying the given function. Non-element child nodes occur in the result element unaltered.
That is, returns the equivalent of:
val newChildren = children flatMap { case e: E => f(e) case n: N => Vector(n) } withChildren(newChildren)
Transforms the element by applying the given function to all its descendant elements, in a bottom-up manner.
Transforms the element by applying the given function to all its descendant elements, in a bottom-up manner.
That is, returns the equivalent of:
transformChildElems (e => e.transformElemsOrSelf(f))
Transforms the element by applying the given function to all its descendant-or-self elements, in a bottom-up manner.
Transforms the element by applying the given function to all its descendant-or-self elements, in a bottom-up manner.
That is, returns the equivalent of:
f(transformChildElems (e => e.transformElemsOrSelf(f)))
In other words, returns the equivalent of:
f(transformElems(f))
Transforms each descendant element to a node sequence by applying the given function to all its descendant-or-self elements, in a bottom-up manner.
Transforms each descendant element to a node sequence by applying the given function to all its descendant-or-self elements, in a bottom-up manner.
That is, returns the equivalent of:
f(transformChildElemsToNodeSeq(e => e.transformElemsOrSelfToNodeSeq(f)))
In other words, returns the equivalent of:
f(transformElemsToNodeSeq(f))
Transforms each descendant element to a node sequence by applying the given function to all its descendant elements, in a bottom-up manner.
Transforms each descendant element to a node sequence by applying the given function to all its descendant elements, in a bottom-up manner. The function is not applied to this element itself.
That is, returns the equivalent of:
transformChildElemsToNodeSeq(e => e.transformElemsOrSelfToNodeSeq(f))
It is equivalent to the following expression:
transformElemsOrSelf { e => e.transformChildElemsToNodeSeq(che => f(che)) }
Returns text.trim
.
Returns text.trim
.
Creates a copy, but with (only) the children passed as parameter newChildren
Builder for elements. See eu.cdevreeze.yaidom.simple.NodeBuilder.
See the documentation of the mixed-in query API trait(s) for more details on the uniform query API offered by this class.