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><b/><c/><c id="1"/></a>' b = doc.root.elements[1] doc.root.elements.delete b #-> <a><c/><c id="1"/></a> doc.elements.delete("a/c[@id='1']") #-> <a><c/></a> doc.root.elements.delete 1 #-> <a/>