Builder::XmlMarkup use

I'm using ::Builder::XmlMarkup like this: \[code\] # This is a class method in /lib, run ascynchronously using delayed_job. # Bunch of file io / header stuff, then... books.each do |book| xml.Product do xml.RecordReference "com.domain-#{book.id}" xml.NotificationType book.notification unless book.notification.blank? xml.ProductIdentifier do xml.ProductIDType "15" xml.IDValue book.isbn unless book.isbn.blank? end book.productcodes.each do |productcode| unless productcode.idtype == "15" xml.ProductIdentifier do xml.ProductIDType productcode.idtype unless productcode.idtype.blank? xml.IDValue productcode.idvalue unless productcode.idvalue.blank? end end end xml.ProductForm book.format unless book.format.blank? xml.ProductFormDetail book.format_detail unless book.format_detail.blank? xml.ProductFormDescription book.format_description unless book.format_description.blank?\[/code\]etc. Trouble is, it goes on for another 250 lines. Is this how you're meant to build XML files full of bitty elements? It doesn't seem very Rubyish.
 
Back
Top