Reputation: 1509
I'm using Nokogiri to generate XML:
Nokogiri::XML::Builder.new do |xml|
xml['nitf'].nitf('xmlns:nitf' => 'bar') {
// some nodes here
xml.body {
xml.head {
//some nodes here
}
}
}
end
The output is
<nitf:nitf xmlns:nitf="http://iptc.org/std/NITF/2006-10-18/">
// some nodes here
<nitf:body>
<nitf:head>
// some nodes here
</nitf:head>
</nitf:body>
</nitf:nitf>
But I need to have <nitf:body.head>
instead of <nitf:head>
. How to achieve such a result?
Upvotes: 0
Views: 128
Reputation: 1509
Solved using #send
:
xml.body {
xml.send('body.head') {
...
}
}
<nitf:body>
<nitf:body.head>
...
</nitf:body.head>
</nitf:body>
Upvotes: 1