我創建LinkedIn這樣的客戶端。如何將LinkedIn客戶端的rails轉換爲哈希
client = LinkedIn::Client.new("3333", "rrrrrrr")
client.authorize_from_access(session[:atoken], session[:asecret])
,並得到這樣的個人資料,這
@profile = client.profile
當我打印像 「放client.profile」 的個人主頁上,我得到以下出來把
#<LinkedIn::Profile:0x4a77770 @doc=#<Nokogiri::XML::Document:0x253bb64 name="document" children=[#<Nokogiri::XML::Element:0x253b9fc name="pers
on" children=[#<Nokogiri::XML::Text:0x253b87c "\n ">, #<Nokogiri::XML::Element:0x253b84c name="first-name" children=[#<Nokogiri::XML::Text:0x
253b684 "Anthony">]>, #<Nokogiri::XML::Text:0x253b5ac "\n ">, #<Nokogiri::XML::Element:0x253b57c name="last-name" children=[#<Nokogiri::XML::
Text:0x253b3b4 "Raj S">]>, #<Nokogiri::XML::Text:0x253b2dc "\n ">, #<Nokogiri::XML::Element:0x253b2ac name="headline" children=[#<Nokogiri::X
ML::Text:0x253b0e4 "Senior Software Engineer at AB Innovative Software Pvt. Ltd">]>, #<Nokogiri::XML::Text:0x253b00c "\n ">, #<Nokogiri::XML:
:Element:0x253afdc name="site-standard-profile-request" children=[#<Nokogiri::XML::Text:0x253ae14 "\n ">, #<Nokogiri::XML::Element:0x253ade
4 name="url" children=[#<Nokogiri::XML::Text:0x253ac1c "http://www.linkedin.com/profile?viewProfile=&key=78718913&authToken=XE_V&authType=name
&trk=api*a178337*s186521*">]>, #<Nokogiri::XML::Text:0x253ab44 "\n ">]>, #<Nokogiri::XML::Text:0x253aa6c "\n">]>]>>
如何解析這個到一個hasmap或一個字符串?
請幫助我,因爲我是新來的鐵軌。
看到... http://stackoverflow.com/questions/10122342/how-to-convert-nokogiri-object-to- xml-file-in-rails/10122666#10122666 – davidb 2012-04-12 11:31:01
你想在hashmap/string中做什麼? – Phrogz 2012-04-13 15:13:46