Reputation: 1019
With Nokogiri how can one insert Node object content into XML::Builder structures?
#source nodes
mynodes = [...array of Nodes...]
#where I want to dump source nodes
target_for_nodes = somebuilder.doc.xpath('//mydoc/mynodecollection').first
#drop the nodes into place
Nokogiri::XML::Builder.with(target_for_nodes) do |xml|
mynodes.each do |node|
xml.text node.to_xml #gives escaped text- how to drop real XML here from the Node?
end
end
It gives escaped text but it is not clear to me how to drop real XML here from the Node objects?
Upvotes: 2
Views: 756
Reputation: 1019
Hmmm. It seems I just need to use
xml << node.to_xml
rather than
xml.text node.to_xml
Cheers!
Upvotes: 5