def parse_search_results(string, extraction_fields = nil)
      xml = Nokogiri::XML.parse(string, "file:///rawfile.xml")
      items = xml/"/#{@xml_element_root}/*"
      total = items.length
      @logger.debug("Found #{total} articles in input pubmed file")
      items.each do |item|
        begin
          mArticle = RayyanFormats::Target.new
          failed = false
          case item.node_name
          when @xml_element_root_article
            process_article_detail_page(item, mArticle, extraction_fields)
          when @xml_element_root_book
            process_book_detail_page(item, mArticle, extraction_fields)
          else
            @logger.warn "Unknown XML format for search result of type #{item.node_name}"
            failed = true
          end

          unless failed
            pmid = ScraperBase.node_text item, './/PMID'
            mArticle.sid = pmid
            mArticle.url = "#{@detail_friendly_url}#{pmid}"
            yield mArticle, total if block_given?
          end # unless failed
        rescue => exception
          @logger.error "Error processing item in search result of type #{item.node_name} [#{exception}] " +
            "caused by #{exception.backtrace.first}"
        end # process item rescue
      end # items.each
      total
    end
def parse_search_results(string, extraction_fields = nil)
      xml = Nokogiri::XML.parse(string, "file:///rawfile.xml")
      items = xml/"/#{@xml_element_root}/*"
      total = items.length
      @logger.debug("Found #{total} articles in input pubmed file")
      items.each do |item|
        begin
          mArticle = RayyanFormats::Target.new
          failed = false
          case item.node_name
          when @xml_element_root_article
            process_article_detail_page(item, mArticle, extraction_fields)
          when @xml_element_root_book
            process_book_detail_page(item, mArticle, extraction_fields)
          else
            @logger.warn "Unknown XML format for search result of type #{item.node_name}"
            failed = true
          end

          unless failed
            pmid = ScraperBase.node_text item, './/PMID'
            mArticle.sid = pmid
            mArticle.url = "#{@detail_friendly_url}#{pmid}"
            yield mArticle, total if block_given?
          end # unless failed
        rescue => exception
          @logger.error "Error processing item in search result of type #{item.node_name} [#{exception}] " +
            "caused by #{exception.backtrace.first}"
        end # process item rescue
      end # items.each
      total
    end
user upload xml