If you pass a hash to the method creatig the tag it will be used to create attributes:
builder = Nokogiri::XML::Builder.new do |xml|
xml.PmtId{
xml.EndToEndId "value"
xml.InstdAmt "value", :Ccd => 'Eur'
xml.ChrgBr "value"
}
end
puts builder.to_xml
produces:
<?xml version="1.0"?>
<PmtId>
<EndToEndId>value</EndToEndId>
<InstdAmt Ccd="Eur">value</InstdAmt>
<ChrgBr>value</ChrgBr>
</PmtId>