From aa5121c910822982565c6930f58b7be052d33a20 Mon Sep 17 00:00:00 2001 From: rautenberg Date: Wed, 14 Sep 2016 18:32:36 +0200 Subject: fix catalog referencing search method --- lib/qmrf-report.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/qmrf-report.rb b/lib/qmrf-report.rb index a83bf6d..2c6cde8 100644 --- a/lib/qmrf-report.rb +++ b/lib/qmrf-report.rb @@ -80,9 +80,9 @@ module OpenTox # @return [Error] returns Error message if fails def change_catalog catalog, id, valuehash catalog_exists? catalog - if @report.at_css("#{catalog}").at("//*[@id='#{id}']") + if @report.at_css("#{catalog}").at("[@id='#{id}']") valuehash.each do |key, value| - @report.at_css("#{catalog}").at("//*[@id='#{id}']")["#{key}"]= value + @report.at_css("#{catalog}").at("[@id='#{id}']")["#{key}"]= value end else cat = @report.at_css("#{catalog}") @@ -106,7 +106,7 @@ module OpenTox catalog_exists? catalog if @report.at_css("#{catalog}").at("//*[@id='#{id}']") chap = @report.at_css("#{chapter}") - if chap.at("//*[@idref='#{id}']").nil? + if chap.at("[@idref='#{id}']").nil? newentry = Nokogiri::XML::Node.new("#{catalog.to_s.gsub(/s?_catalog/,'_ref')}", self.report) newentry["idref"] = id chap << newentry @@ -123,8 +123,8 @@ module OpenTox # @return [String, false] returns value of a key in a catalog node or false if catalog entry do not exists. def get_catalog_value catalog, id, key catalog_exists? catalog - if @report.at_css("#{catalog}").at("//*[@id='#{id}']") - @report.at_css("#{catalog}").at("//*[@id='#{id}']")["#{key}"] + if @report.at_css("#{catalog}").at("[@id='#{id}']") + @report.at_css("#{catalog}").at("[@id='#{id}']")["#{key}"] else return false end -- cgit v1.2.3