Method: MARC::GenericPullParser#start_element_namespace

Defined in:
lib/marc/xml_parsers.rb

#start_element_namespace(name, attributes = [], prefix = nil, uri = nil, ns = {}) ⇒ Object



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/marc/xml_parsers.rb', line 77

def start_element_namespace name, attributes = [], prefix = nil, uri = nil, ns = {}
  attributes = attributes_to_hash(attributes)
  if (uri == @ns) || @ignore_namespace
    case name.downcase
    when SF_TAG
      @current_element = :subfield
      @record[:subfield] = MARC::Subfield.new(attributes[CODE])
    when DF_TAG
      @record[:field] = MARC::DataField.new(attributes[TAG], attributes[IND1], attributes[IND2])
    when CF_TAG
      @current_element = :field
      @record[:field] = MARC::ControlField.new(attributes[TAG])
    when LEAD_TAG then @current_element = :leader
    when REC_TAG then @record[:record] = MARC::Record.new
    end
  end
end