# File lib/nokogiri/xml/document.rb, line 80 def add_child child if [Node::ELEMENT_NODE, Node::DOCUMENT_FRAG_NODE].include? child.type raise "Document already has a root node" if root end super end