Shorthand for filterChildElems(p)
.
Shorthand for attributeOption(expandedName)
.
Shorthand for attributeOption(expandedName)
.
Shorthand for filterElemsOrSelf(p)
.
Shorthand for findTopmostElemsOrSelf(p)
.
Returns ancestorsOrSelf.drop(1)
Returns ancestorsOrSelf.drop(1)
Returns all ancestor elements or self
Returns all ancestor elements or self
Returns the value of the attribute with the given expanded name, and throws an exception otherwise.
Returns the value of the attribute with the given expanded name, and throws an exception otherwise.
Returns the QName value of the attribute with the given expanded name, and throws an exception otherwise
Returns the QName value of the attribute with the given expanded name, and throws an exception otherwise
Returns the QName value of the attribute with the given expanded name, if any, wrapped in an Option
.
Returns the QName value of the attribute with the given expanded name, if any, wrapped in an Option
.
If the attribute exists, but its value is not a QName, an exception is thrown.
Returns the resolved QName value (as EName) of the attribute with the given expanded name, and throws an exception otherwise
Returns the resolved QName value (as EName) of the attribute with the given expanded name, and throws an exception otherwise
Returns the resolved QName value (as EName) of the attribute with the given expanded name, if any, wrapped in an Option
.
Returns the resolved QName value (as EName) of the attribute with the given expanded name, if any, wrapped in an Option
.
None is returned if the attribute does not exist. If the QName value cannot be resolved given the scope of the element,
an exception is thrown.
Returns the value of the attribute with the given expanded name, if any, wrapped in an Option
.
Returns the value of the attribute with the given expanded name, if any, wrapped in an Option
.
The attribute Scope
, which is the same Scope
but without the default namespace (which is not used for attributes)
The attributes of the element as mapping from QNames to values
The attributes of the element as mapping from QNames to values
Returns the comment 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
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 ancestor element obeying the given predicate, if any, wrapped in an Option
Returns the first found ancestor element obeying the given predicate, if any, wrapped in an Option
Returns the first found ancestor-or-self element obeying the given predicate, if any, wrapped in an Option
Returns the first found ancestor-or-self element obeying the given predicate, if any, wrapped in an Option
Returns the first found attribute value of an attribute with the given local name, if any, wrapped in an Option
.
Returns the first found attribute value of an attribute with the given local name, if any, wrapped in an Option
.
Because of differing namespaces, it is possible that more than one such attribute exists, although this is not often the case.
Returns the first found child element obeying the given predicate, if any, wrapped in an Option
.
Finds the child element with the given Path.Entry
(where this element is the root), if any, wrapped in an Option
.
Finds the child element with the given Path.Entry
(where this element is the root), 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
.
Finds the element with the given Path
(where this element is the root), if any, wrapped in an Option
.
Finds the element with the given Path
(where this element is the root), if any, wrapped in an Option
.
This method must be very efficient, which depends on the efficiency of method findChildElemByPathEntry
.
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 equivalent of) findChildElemByPathEntry(entry).get
Returns (the equivalent of) findChildElemByPathEntry(entry).get
Returns (the equivalent of) findElemOrSelfByPath(path).get
Returns (the equivalent of) findElemOrSelfByPath(path).get
The local name, that is, the local part of the EName
The local name, that is, the local part of the EName
Returns XmlStringUtils.normalizeString(text)
.
Returns XmlStringUtils.normalizeString(text)
.
Returns the equivalent parentOption.get
, throwing an exception if this is the root element
Returns the equivalent parentOption.get
, throwing an exception if this is the root element
Returns the parent element, if any, wrapped in an Option
Returns the parent element, if any, wrapped in an Option
The QName of the element
The QName of the element
The attributes as an ordered mapping from EName
s (instead of QName
s) to values, obtained by resolving attribute QName
s against the attribute scope
The attributes as an ordered mapping from EName
s (instead of QName
s) to values, obtained by resolving attribute QName
s against the attribute scope
The EName of the element
The EName of the element
The Scope stored with the element
The Scope stored with 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 QName(text.trim)
Returns QName(text.trim)
Returns the equivalent of scope.resolveQNameOption(textAsQName).get
Returns the equivalent of scope.resolveQNameOption(textAsQName).get
Returns the text children
Returns text.trim
.
Returns text.trim
.
Wrapper around
org.w3c.dom.Element
, conforming to the eu.cdevreeze.yaidom.queryapi.ElemLike API.See the documentation of the mixed-in query API trait(s) for more details on the uniform query API offered by this class.
By design the only state of the DomElem is the wrapped element. Otherwise it would be easy to cause any inconsistency between this wrapper element and the wrapped element. The down-side is that computing the resolved name or resolved attributes is expensive, because on each call first the in-scope namespaces are computed (by following namespace declarations in the ancestry and in the element itself). This is done for reliable namespace support, independent of namespace-awareness of the underlying element's document.
This choice for reliable namespace support (see the documented properties of
ScopedElemApi
) and defensive handling of mutable state makes this DomElem slower (when querying for resolved names or attributes) than other wrapper element implementations, such asScalaXmlElem
. On the other hand, if the use oforg.w3c.dom
is a given, then this DomElem makes namespace-aware querying of DOM elements far easier than direct querying of DOM elements.