XML 使用 Nokogiri 的编队

XML Formation using Nokogiri

我正在尝试使用下面显示的代码段创建一个 xml 文档。

我的代码如下图:

require 'nokogiri'

builder = Nokogiri::XML::Builder.new do
    {
        action "GetApplication"
        email "apiorder@rently.com"
        password "f1467868c64f818c7b9394d85cc46d98"
        request {
            response_format "detailed"
            application_id "15544"
            render_applicant_extended_fields {
                ari_criminal_info ""
                ari_evictions_info ""
                limelyte_employment ""
                limelyte_drivers_license""
            }
        }
    }
end

req_body = builder.to_xml

但是当我尝试将其转换为 XML 时,我 运行 出现了这个错误

如何克服这个限制?任何帮助将不胜感激。

试试这个:

require 'nokogiri'

builder = Nokogiri::XML::Builder.new do
  root {
    action "GetApplication"
    email "apiorder@rently.com"
    password "f1467868c64f818c7b9394d85cc46d98"
    request {
      response_format "detailed"
      application_id "15544"
      render_applicant_extended_fields {
        ari_criminal_info ""
        ari_evictions_info ""
        limelyte_employment ""
        limelyte_drivers_license""
      }
    }
  }
end

req_body = builder.to_xml