delete

delete(element)
Instance Public methods

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/>
doc_ruby_on_rails
2015-05-06 13:11:00
Comments
Leave a Comment

Please login to continue.