delete(element) public

Deletes a child Element

element

Either an Element, which is removed directly; an xpath, where the first matching child is removed; or an Integer, where the n’th Element is removed.

Returns

the removed child

doc = Document.new ‘<a><c/><c id=“1”/>’ b = doc.root.elements[1] doc.root.elements.delete b #-> <a><c/><c id=“1”/> doc.elements.delete(“a/c[@id=‘1’]”) #-> <a><c/> doc.root.elements.delete 1 #-> <a/>

Show source
Register or log in to add new notes.