Rexml help

such as "interval". If I try to use XPath in this fashion..

  interval = parent.elements.to_a( "interval" )[0].text

..and the "interval" node doesn't exist, it's going to raise a
NoMethodError. I *could* just rescue and ignore that error, but

that

You *should* check whether you get back a result. Specifically, using
exceptions as a flow control mechanism is, generally, considered poor
form, if for no other reason than that it is expensive. Incidentally,
you don't need to use #to_a() if you want the first element.
#elements returns the first match:

interval = parent.elements[ "interval" ] // Get the first interval
node
interval = interval ? interval.text : nil // If a node was
found, get the text; otherwise, nil

--- SER