0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

xml 作成方法

Posted at
  • gem 'builder' install
  • データのブループ化
require 'builder'

builder = Builder::XmlMarkup.new



builder.result do

  builder.profile do
    builder.name "test_name"
    builder.age 22
  end

  builder.settlement do
    builder.uid "uid-0802222-2222"
    builder.credit_type "visa"
    builder.last_3 "098"
  end
end

p builder

➜  test ruby sample.rb
<result><profile><name>test_name</name><age>22</age></profile><settlement><uid>uid-0802222-2222</uid><credit_type>visa</credit_type><last_3>098</last_3></settlement></result><inspect/>
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?