# File lib/marc/datafield.rb, line 55
    def initialize(tag, i1=' ', i2=' ', *subfields)
      # if the tag is less than 3 characters long and 
      # the string is all numeric then we pad with zeros
      if tag.length < 3 and /^[0-9]*$/ =~ tag
        @tag = "%03d" % tag
      else
        @tag = tag 
      end
      # can't allow nil to be passed in or else it'll 
      # screw us up later when we try to encode
      @indicator1 = i1 == nil ? ' ' : i1
      @indicator2 = i2 == nil ? ' ' : i2
      @subfields = []

      # must use MARC::ControlField for tags < 010 or
      # those in MARC::ControlField#extra_control_fields
      
      if MARC::ControlField.control_tag?(@tag)
        raise MARC::Exception.new(),
          "MARC::DataField objects can't have ControlField tag '" + @tag + "')"
      end

      # allows MARC::Subfield objects to be passed directly
      # or a shorthand of ['a','Foo'], ['b','Bar']
      subfields.each do |subfield| 
        case subfield
        when MARC::Subfield
          @subfields.push(subfield)
        when Array
          if subfield.length > 2
            raise MARC::Exception.new(),
              "arrays must only have 2 elements: " + subfield.to_s 
          end
          @subfields.push(
            MARC::Subfield.new(subfield[0],subfield[1]))
        else 
          raise MARC::Exception.new(), 
            "invalid subfield type #{subfield.class}"
        end
      end
    end