Is it possible to omit the processing instruction

2019-05-21 06:54发布

问题:

Possible Duplicate:
Print an XML document without the XML header line at the top

I'm trying to create a fragment of XML using the Nokogiri::XML::Builder but I can't find any documentation on how to exclude the processing instruction (<?xml version=...)

Can anyone point me in the right direction?

回答1:

Now I can answer:

doc.to_xml :save_with => Nokogiri::XML::Node::SaveOptions::NO_DECLARATION