[]
Arguments
index
the search parameter. This is either an Integer, which will be used to find the index'th child Element, or an XPath, which will be used to search for the Element. NOTE that because of the nature of XPath searches, any element in the connected XML document can be fetched through any other element.
name<nil>
optional, and only used in the first argument is an Integer. In that case, the index'th child Element that has the supplied name will be returned. Note that the indexes start at 1.
Returns
the first matching Element, or nil if no child matched
Fetches a child element
[]=
Arguments
index
is used to find a matching element to replace. See []().
element
the element to replace the existing element with
Returns
the previous element; nil if no previous element was found.
Sets an element, replacing any previous matching element. If no existing element is found ,the element is added.
delete_all
Arguments
xpath
all elements matching this String path are removed.
Returns
an Array of Elements that have been removed
Removes multiple elements
each
Arguments
xpath<nil>
optional. If supplied, this is a String XPath, and is used to filter the children, so that only matching children are yielded
Iterates through all of the child Elements, optionally filtering them by a given XPath Only supply the first parameter (and a block). The second parameter is used internally for recursion.
index
Arguments
element
a child of this Element
Returns
the index of the supplied child (starting at 1), or -1 if the element is not a child
@return the index of the supplied child (starting at 1), or -1 if the element is not a child