What are you after?  The answer really depends on your situation.

Two options come to mind:

A custom rake task.  You can see a simple example here that uses YAML
instead of XML as source data:

http://github.com/kete/kete/blob/master/lib/tasks/user_export_import.rake

Here's an example of parsing from source XML (modify this and replace
the YAML parsing the above rake task):

http://github.com/kete/kete/blob/master/lib/workers/excel_based_importer_worker.rb
- starting around line 30, note the hardcoding of element names that
you need to adjust

Another option, if you have already created a RESTful interface that
accepts XML for creating new records, you might simply create a script
that parses your existing XML file and submits a POST to your create
action with the relevant data.  Not necessarily the fastest process,
but if it is a one off import it might be the quickest thing to put
together programming wise.  Net::HTTP and Nokogiri seem like all you
really need.

I would probably just go with the rake task.  Pretty simple.

Cheers,
Walter

On Tue, Mar 16, 2010 at 2:54 AM, WSzP <[email protected]> wrote:
> Try using Nokogiri: http://nokogiri.org/ It's a great and easy to use
> parser.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to