final class ElemBuilder extends CanBeDocBuilderChild with ElemLike with TransformableElemLike with HasQNameApi
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.
- Annotations
- @SerialVersionUID()
- Alphabetic
- By Inheritance
- ElemBuilder
- HasQNameApi
- TransformableElemLike
- TransformableElemApi
- AnyElemNodeApi
- ElemLike
- ElemApi
- AnyElemApi
- CanBeDocBuilderChild
- NodeBuilder
- Serializable
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new ElemBuilder(qname: QName, attributes: IndexedSeq[(QName, String)], namespaces: Declarations, children: IndexedSeq[NodeBuilder])
Type Members
-
type
NodeType = Elem
- Definition Classes
- ElemBuilder → CanBeDocBuilderChild → NodeBuilder
-
type
ThisElem = ElemBuilder
The element type itself.
The element type itself. It must be restricted to a sub-type of the query API trait in question.
Concrete element classes will restrict this type to that element class itself.
- Definition Classes
- ElemBuilder → TransformableElemLike → TransformableElemApi → ElemLike → ElemApi → AnyElemApi
-
type
ThisNode = NodeBuilder
The node type, that is a super-type of the element type, but also of corresponding text node types etc.
The node type, that is a super-type of the element type, but also of corresponding text node types etc.
- Definition Classes
- ElemBuilder → AnyElemNodeApi
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
\(p: (ThisElem) ⇒ Boolean): IndexedSeq[ThisElem]
Shorthand for
filterChildElems(p)
. -
def
\\(p: (ThisElem) ⇒ Boolean): IndexedSeq[ThisElem]
Shorthand for
filterElemsOrSelf(p)
. -
def
\\!(p: (ThisElem) ⇒ Boolean): IndexedSeq[ThisElem]
Shorthand for
findTopmostElemsOrSelf(p)
. -
def
allDeclarationsAreAtTopLevel: Boolean
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. -
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
val
attributes: IndexedSeq[(QName, String)]
The attributes of the element as mapping from QNames to values
The attributes of the element as mapping from QNames to values
- Definition Classes
- ElemBuilder → HasQNameApi
-
def
build(parentScope: Scope): Elem
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.- Definition Classes
- ElemBuilder → NodeBuilder
-
final
def
build(): NodeType
Returns
build(Scope.Empty)
Returns
build(Scope.Empty)
- Definition Classes
- NodeBuilder
-
def
canBuild(parentScope: Scope): Boolean
Returns true if parentScope suffices to build an
Elem
, that is, ifbuild(parentScope)
returns anElem
instead of throwing an exception.Returns true if parentScope suffices to build an
Elem
, that is, ifbuild(parentScope)
returns anElem
instead of throwing an exception.A complete
ElemBuilder
tree should obey propertycanBuild(Scope.Empty)
. - val children: IndexedSeq[NodeBuilder]
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
copy(qname: QName = this.qname, attributes: IndexedSeq[(QName, String)] = this.attributes, namespaces: Declarations = this.namespaces, children: IndexedSeq[NodeBuilder] = this.children): ElemBuilder
Creates a copy, altered with the explicitly passed parameters (for qname, attributes, namespaces and children).
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
filterChildElems(p: (ThisElem) ⇒ Boolean): IndexedSeq[ThisElem]
Returns the child elements obeying the given predicate.
-
def
filterElems(p: (ThisElem) ⇒ Boolean): IndexedSeq[ThisElem]
Returns the descendant elements obeying the given predicate, in document order.
-
def
filterElemsOrSelf(p: (ThisElem) ⇒ Boolean): IndexedSeq[ThisElem]
Returns the descendant-or-self elements obeying the given predicate, in document order.
Returns the descendant-or-self elements obeying the given predicate, in document order. This method could be defined as:
def filterElemsOrSelf(p: ThisElem => Boolean): immutable.IndexedSeq[ThisElem] = Vector(this).filter(p) ++ (this.findAllChildElems flatMap (_.filterElemsOrSelf(p)))
It can be proven that the result is equivalent to
findAllElemsOrSelf filter p
. -
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
findAllChildElems: IndexedSeq[ElemBuilder]
Returns the element children as ElemBuilder instances
Returns the element children as ElemBuilder instances
- Definition Classes
- ElemBuilder → ElemLike → ElemApi
-
def
findAllElems: IndexedSeq[ThisElem]
Returns all descendant elements (not including this element), in document order.
-
def
findAllElemsOrSelf: IndexedSeq[ThisElem]
Returns this element followed by all descendant elements (that is, the descendant-or-self elements), in document order.
-
def
findChildElem(p: (ThisElem) ⇒ Boolean): Option[ThisElem]
Returns the first found child element obeying the given predicate, if any, wrapped in an
Option
. -
def
findElem(p: (ThisElem) ⇒ Boolean): Option[ThisElem]
Returns the first found (topmost) descendant element obeying the given predicate, if any, wrapped in an
Option
. -
def
findElemOrSelf(p: (ThisElem) ⇒ Boolean): Option[ThisElem]
Returns the first found (topmost) descendant-or-self element obeying the given predicate, if any, wrapped in an
Option
. -
def
findTopmostElems(p: (ThisElem) ⇒ Boolean): IndexedSeq[ThisElem]
Returns the descendant elements obeying the given predicate that have no ancestor obeying the predicate.
-
def
findTopmostElemsOrSelf(p: (ThisElem) ⇒ Boolean): IndexedSeq[ThisElem]
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: ThisElem => Boolean): immutable.IndexedSeq[ThisElem] = if (p(this)) Vector(this) else (this.findAllChildElems flatMap (_.findTopmostElemsOrSelf(p)))
-
def
getChildElem(p: (ThisElem) ⇒ Boolean): ThisElem
Returns the single child element obeying the given predicate, and throws an exception otherwise.
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- val namespaces: Declarations
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
nonDeclaredPrefixes(parentScope: Scope): Set[String]
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.
-
def
normalizedText: String
Returns
XmlStringUtils.normalizeString(text)
. -
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
plusChild(newChild: NodeBuilder): ElemBuilder
Returns
withChildren(thisElem.children :+ newChild)
. -
val
qname: QName
The QName of the element
The QName of the element
- Definition Classes
- ElemBuilder → HasQNameApi
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
text: String
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.
-
def
textChildren: IndexedSeq[TextBuilder]
Returns the text children
-
def
thisElem: ThisElem
This element itself.
This element itself.
- Definition Classes
- ElemBuilder → AnyElemApi
-
final
def
toString(): String
Returns
toTreeRepr
.Returns
toTreeRepr
.- Definition Classes
- NodeBuilder → AnyRef → Any
-
final
def
toTreeRepr(parentScope: Scope): String
Returns the tree representation.
Returns the tree representation. See the corresponding method in eu.cdevreeze.yaidom.simple.Node.
- Definition Classes
- NodeBuilder
-
def
transformChildElems(f: (ElemBuilder) ⇒ ElemBuilder): ElemBuilder
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)
- Definition Classes
- ElemBuilder → TransformableElemLike → TransformableElemApi
-
def
transformChildElemsToNodeSeq(f: (ElemBuilder) ⇒ IndexedSeq[NodeBuilder]): ElemBuilder
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)
- Definition Classes
- ElemBuilder → TransformableElemLike → TransformableElemApi
-
def
transformElems(f: (ThisElem) ⇒ ThisElem): ThisElem
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))
- Definition Classes
- TransformableElemLike → TransformableElemApi
-
def
transformElemsOrSelf(f: (ThisElem) ⇒ ThisElem): ThisElem
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))
- Definition Classes
- TransformableElemLike → TransformableElemApi
-
def
transformElemsOrSelfToNodeSeq(f: (ThisElem) ⇒ IndexedSeq[ThisNode]): IndexedSeq[ThisNode]
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))
- Definition Classes
- TransformableElemLike → TransformableElemApi
-
def
transformElemsToNodeSeq(f: (ThisElem) ⇒ IndexedSeq[ThisNode]): ThisElem
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)) }
- Definition Classes
- TransformableElemLike → TransformableElemApi
-
def
trimmedText: String
Returns
text.trim
. -
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
withChildren(newChildren: IndexedSeq[NodeBuilder]): ElemBuilder
Creates a copy, but with (only) the children passed as parameter
newChildren