xml = Nokogiri::XML("<request><abc></abc><haha>sdf</haha><def></def></request>"){|config| config.noblanks }
cur_node = xml.search("//def").first
def del_all_prev(node)
if node.previous_sibling
del_all_prev(node.previous_sibling)
end
node.remove
end
del_all_prev(cur_node.previous_sibling)