Parsing variable length XML?

I’m new to Ruby and need to write some code to parse a variable length
XML structure like the one below. In the below case, the time
can occur a variable number of times. I want to store each one of
these port numbers into a separate database record.

Also, is there anyway for Rails to automatically insert these into a
relational set of models. For instance, the Address record would
contain the ‘host’ and then a many to many relationship to a bunch of
port numbers. Are there any features or libraries to make this mapping
easier when parsing?

Thanks
Chirag

example.org 1234 5678 ... 6789

chirag wrote:

I’m new to Ruby and need to write some code to parse a variable length
XML structure like the one below. In the below case, the time
can occur a variable number of times. I want to store each one of
these port numbers into a separate database record.

Also, is there anyway for Rails to automatically insert these into a
relational set of models. For instance, the Address record would
contain the ‘host’ and then a many to many relationship to a bunch of
port numbers. Are there any features or libraries to make this mapping
easier when parsing?

Thanks
Chirag

example.org 1234 5678 ... 6789

Do a Google search for REXML. It’s a standard Ruby library. It will do
all the XML parsing you need.

–Al Evans