2010-11-28 7 views
0

私はGoogleに挑戦してきましたが、これを行う方法についていくつかのガイドや見出しを見つけましたが、役に立たなかった。タイトルが正しいかどうかはわかりません。私はそれがメタプログラミングであろうと、RailsへのXMLデータの解析であろうと、その言葉を知らない。XML APIデータをRailsアプリケーションに解析する

私のウェブサイトにデータを供給するためにXML APIを提供することに同意したこの第三者がいるとします。データを受け取り、私のモデルに保存したいと思います。私はSOを通して確認し、私の質問に部分的に答えるこのリンクを見つけました:Parse then Store XML Data from API in Ruby on Rails、しかし私は私のサードパーティの方法に適用する正確な方法を知りたいと思います。

サンプルプロパティ情報要求

http://third-party.com/xmlapi/PropertyInformation.php?PropertyNumber=113 

サンプルプロパティ情報の要求は、私は私のモデル列にPropertyNumberを持って

<?xml version="1.0" ?> 
<PropertyInformation size="1"> 
<Property size="12"> 
<propertyNumber>113</propertyNumber> 
<propertyName>Kinlay House Christchurch</propertyName> 
<address1>2-12 Lord Edward Street</address1> 
<address2>Dublin 2</address2> 
<city>Dublin</city> 
<country>Ireland</country> 
<description>Situated in the Temple Bar district in the heart of Dublin, Kinlay House offers a wide selection of clean and comfortable rooms that won't break the bank. Temple Bar offers visitors an unrivalled selection of bars, cafes and restaurants, all infused with a lively Irish flavour. Within easy walking distance of Grafton Street - Dublin's main shopping Street - and the vast selection of museums, galleries and tourist attractions that the city has to offer. Come and enjoy the great atmosphere and vibrant spirit! <i>YOU CAN ALSO BOOK KINLAY HOUSE CORK AND KINLAY HOUSE GALWAY ONLINE</i> Self-catering kitchen 24 hour staffing, no curfew Security lockers/luggage storage Tourist Information & booking service International pay phones Family friendly</description> 
</Property> 
</PropertyInformation> 

結果。構造化URLを使用してモデルに情報を解析して保存するにはどうすればよいですか?

実際に、これらのすべてを知ることができるリンクはありますか?

多くの感謝!このような短いXMLの

+0

それはメタプログラミングではないです。)解析が必要です。 Nokogiriライブラリをチェックしてください。これはXML解析に非常に適しています。 –

答えて

関連する問題