6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/watir-or/readers/xml.rb', line 6
def self.read(file, options = nil, &block)
doc = Nokogiri::XML(File.read(file), nil, 'UTF-8', Nokogiri::XML::ParseOptions::NOBLANKS)
doc.root.xpath("//object").each do |node|
name = node['name']
type = nil
locate = node.search('./locate').first.content
locate_block = if node['type'].nil?
Proc.new { locate { |repository| eval(locate) } }
else
type = eval(node['type'])
Proc.new { |repository| eval(locate) }
end
yield name, type, locate_block
end
end
|