class Solr::Importer::XPathMapper

For files with the first line containing field names

Public Class Methods

new(mapping, options={}) click to toggle source
# File lib/solr/importer/xpath_mapper.rb, line 31
def initialize(mapping, options={})
  raise "libxml not installed"
end

Public Instance Methods

field_data(doc, xpath) click to toggle source
# File lib/solr/importer/xpath_mapper.rb, line 18
def field_data(doc, xpath)
  doc.find(xpath.to_s).collect do |node|
    case node
      when XML::Attr
        node.value
      when XML::Node
        node.content
    end
  end
end