Method: Nokogiri::XML::Node#children=

Defined in:
lib/nokogiri/xml/node.rb

#children=(node_or_tags) ⇒ Object

Set the content for this Node node_or_tags

node_or_tags can be a Nokogiri::XML::Node, a Nokogiri::XML::DocumentFragment, or a String containing markup.

Also see related method inner_html=



349
350
351
352
353
354
355
356
357
# File 'lib/nokogiri/xml/node.rb', line 349

def children=(node_or_tags)
  node_or_tags = coerce(node_or_tags)
  children.unlink
  if node_or_tags.is_a?(XML::NodeSet)
    node_or_tags.each { |n| add_child_node_and_reparent_attrs(n) }
  else
    add_child_node_and_reparent_attrs(node_or_tags)
  end
end