# File lib/nokogiri/xml/node.rb, line 329 def replace(new_node) if new_node.is_a?(Document) raise ArgumentError, "Node.replace requires a Node argument, and cannot accept a Document.\n(You probably want to select a node from the Document with at() or search(), or create a new Node via Node.new().)\n" end replace_with_node new_node end