lib/x12/base.rb
def find(e)
      #puts "Finding [#{e}] in #{self.class} #{name}"
      case self
        when X12::Loop
        # Breadth first
        res = nodes.find{|i| e==i.name }
        return res if res
        # Depth now
        nodes.each{|i| 
          res = i.find(e) if i.kind_of?(X12::Loop)
          return res unless res.nil? or EMPTY==res # otherwise keep looping
        }
        when X12::Segment
        return find_field(e).to_s
      end # case
      return EMPTY
    end
def find(e)
      #puts "Finding [#{e}] in #{self.class} #{name}"
      case self
        when X12::Loop
        # Breadth first
        res = nodes.find{|i| e==i.name }
        return res if res
        # Depth now
        nodes.each{|i| 
          res = i.find(e) if i.kind_of?(X12::Loop)
          return res unless res.nil? or EMPTY==res # otherwise keep looping
        }
        when X12::Segment
        return find_field(e).to_s
      end # case
      return EMPTY
    end
Make a deep copy of the element
 dup
 Recursively find a sub-element, which also has to be of type Base.