title: Find and replace entire HTML nodes with Nokogiri
body: <p>i have an HTML, that should be transformed, having some tags replaced with another tags.</p>
  
  <p>I don't know about these tags, because they will come from db. So, <code>set_attribute</code> or <code>name</code> methods of Nokogiri are not suitable for me.</p>
  
  <p>I need to do it, in a way, like in this pseudo-code:</p>
  
  <pre><code>def preprocess_content
    doc = Nokogiri::HTML( self.content )
    doc.css("div.to-replace").each do |div|
      # "get_html_text" will obtain HTML from db. It can be anything, even another tags, tag groups etc.
      div.replace self.get_html_text
    end
    self.content = doc.css("body").first.inner_html
  end
  </code></pre>
  
  <p>I found <code>Nokogiri::XML::Node::replace</code> method. I think, it is the right direction.</p>
  
  <p>This method expects some <code>node_or_tags</code> parameter.</p>
  
  <p>Which method should i use to create a new Node from text and replace the current one with it? </p>