How do I add a <!-- blahblah --> comment to XML with Nokogiri’s Builder?
I want to have something like:
<root>
<!--blahblah-->
<child/>
</root>
I try something like this:
Nokogiri::XML::Builder.new do |xml|
xml.root {
xml.comment('blahblah')
xml.child
}
end
But that gives me:
<root>
<comment>blahblah</comment>
<child/>
</root>
You can work around this
bugdocumented future feature not present in the current release by usingBuilder#<<as follows:Alternatively, you can monkeypatch in your own version of the future method: