如何将Nokogiri对象转换为rails中的xml文件

这是输出我得到如何将其传达到xml文件。 即使知道结果是什么,我一直在打破我的头脑。 请帮我解决这个问题,因为我是一个新人。

[#<LinkedIn::Position::Resource:0x4a63e80 @position=#<Nokogiri::XML::Element:0x2531fa0 name="position" children=[#, #<Nokogiri::XML::Element:0x2531bf8 name="id" children=[#]>, #, #<Nokogiri::XML::Element:0x253152c name="title" children=[#]>, #, #<Nokogiri::XML::Element:0x2530f8c name="summary" children=[#]>, #, #<Nokogiri::XML::Element:0x252ff6c name="start-date" children=[#, #<Nokogiri::XML::Element:0x252fb28 name="year" children=[#]>, #, #<Nokogiri::XML::Element:0x252f84c name="month" children=[#]>, #]>, #, #<Nokogiri::XML::Element:0x252f4a4 name="is-curre nt" children=[#]>, #, #<Nokogiri::XML::Element:0x252ed3c name= "company" children=[#, #<Nokogiri::XML::Element:0x252e5ec name="id" children=[#]>, #, #<Nokogiri::XML::Element:0x252e25c name="name" children=[#]>, #, #<Nokogiri::XML::Element:0x252df68 nam e="size" children=[#]>, #, #<Nokogiri::XML::Elem ent:0x252dc20 name="type" children=[#]>, #, #<Noko giri::XML::Element:0x252d8d8 name="industry" children=[#]>, #]>, #]>>, #<LinkedIn::Position::Resource:0x4a63b80 @position=#<Nokogiri::XML::Element:0x25 31f1c name="position" children=[#, #<Nokogiri::XML::Element:0x252c444 name="id" children=[#]>, #, #<Nokogiri::XML::Element:0x252bb50 name="title" children=[# ]>, #, #<Nokogiri::XML::Element:0x252ab48 name="s ummary" children=[#]>, #, #<Nokogiri::XML::Elemen t:0x2529858 name="start-date" children=[#, #<Nokogiri::XML::Element:0x25292dc name="year" children =[#]>, #, #<Nokogiri::XML::Element:0x25285e0 name="month" ch ildren=[#]>, #]>, #, #< Nokogiri::XML::Element:0x2527410 name="end-date" children=[#, #<Nokogiri::XML::Element:0x2527218 n ame="year" children=[#]>, #, #<Nokogiri::XML::Element:0x2526 f3c name="month" children=[#]>, #]>, #, #<Nokogiri::XML::Element:0x2526918 name="is-current" children=[#]>, #, #<Nokogiri::XML::Element:0x2526624 name="company" children=[#, #<Nokogi ri::XML::Element:0x252609c name="id" children=[#]>, #, #<No kogiri::XML::Element:0x2525868 name="name" children=[#]>, #, #<Nokogiri::XML::Element:0x2525598 name="type" children=[#]>, #, #<Nokogiri::XML::Element:0x2525118 name="industry" children=[#]>, #, #<Nokogiri::XML::Element:0x2524e24 name="ticker" children=[#]>, #]>, #]>>] 

client.inspect out put is

 #<LinkedIn::Client:0x4a1a908 @csecret=\"jKf6ZYgf8JhMoIJ4\", @access_token=#<OAuth::AccessToken:0x4a1a2c0 @token=\"177ba9cd-3b8e-4776-a7f7-db3f60d6df68\", @response=#, @secret=\"d4641509-703a-42ad-a42a-2bf9ac2a8d48\", @consumer=#<OAuth::Consumer:0x4a1a1d0 @secret=\"jKf6ZYgf8JhMoIJ4\", @key=\"cus7tde3g4pe\", @uri=#, @options={:authorize_path=>\"/uas/oauth/authorize\", :scheme=>:header, :http_method=>:post, :proxy=>nil, :site=>\"https://api.linkedin.com\", :request_token_path=>\"/uas/oauth/requestToken\", :oauth_version=>\"1.0\", :signature_method=>\"HMAC-SHA1\", :access_token_path=>\"/uas/oauth/accessToken\"}, @http=#>, @params={}>, @ctoken=\"cus7tde3g4pe\", @consumer=#<OAuth::Consumer:0x4a1a1d0 @secret=\"jKf6ZYgf8JhMoIJ4\", @key=\"cus7tde3g4pe\", @uri=#, @options={:authorize_path=>\"/uas/oauth/authorize\", :scheme=>:header, :http_method=>:post, :proxy=>nil, :site=>\"https://api.linkedin.com\", :request_token_path=>\"/uas/oauth/requestToken\", :oauth_version=>\"1.0\", :signature_method=>\"HMAC-SHA1\", :access_token_path=>\"/uas/oauth/accessToken\"}, @http=#>, @asecret=\"d4641509-703a-42ad-a42a-2bf9ac2a8d48\", @consumer_options={:authorize_path=>\"/uas/oauth/authorize\", :request_token_path=>\"/uas/oauth/requestToken\", :access_token_path=>\"/uas/oauth/accessToken\"}, @atoken=\"177ba9cd-3b8e-4776-a7f7-db3f60d6df68\">" 

啊好吧现在我明白了…试试这个:

 data = Hash.from_xml(client.profile.to_s) 

HF …