lib/iso_bib_item/bibliographic_item.rb
def to_xml
      Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
        xml.bibitem(id: id) do
          xml.fetched fetched
          title.each { |t| xml.title { t.to_xml xml } }
          link.each { |s| s.to_xml xml }
          docidentifier.each { |di| di.to_xml xml }
          dates.each { |d| d.to_xml xml, full_date: true }
          contributors.each do |c|
            xml.contributor do
              c.role.each { |r| r.to_xml xml }
              c.to_xml xml
            end
          end
          language.each { |l| xml.language l }
          script.each { |s| xml.script s }
          abstract.each { |a| xml.abstract { a.to_xml(xml) } }
          status.to_xml xml if status
          copyright.to_xml xml if copyright
          relations.each { |r| r.to_xml xml }
          series.each { |s| s.to_xml xml } if series
        end
      end.doc.root.to_xml
    end
def to_xml
      Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
        xml.bibitem(id: id) do
          xml.fetched fetched
          title.each { |t| xml.title { t.to_xml xml } }
          link.each { |s| s.to_xml xml }
          docidentifier.each { |di| di.to_xml xml }
          dates.each { |d| d.to_xml xml, full_date: true }
          contributors.each do |c|
            xml.contributor do
              c.role.each { |r| r.to_xml xml }
              c.to_xml xml
            end
          end
          language.each { |l| xml.language l }
          script.each { |s| xml.script s }
          abstract.each { |a| xml.abstract { a.to_xml(xml) } }
          status.to_xml xml if status
          copyright.to_xml xml if copyright
          relations.each { |r| r.to_xml xml }
          series.each { |s| s.to_xml xml } if series
        end
      end.doc.root.to_xml
    end
rubocop:disable Metrics/AbcSize, Metrics/MethodLength
 @return [String]