Skip to content

Commit

Permalink
ruby xml lib tool for text reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
Francesco Lazzarino committed Sep 24, 2008
1 parent 93e384d commit 4e106a0
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions bin/validate2.rb
@@ -0,0 +1,24 @@
#!/usr/bin/ruby

require 'libxml'

include LibXML

# TODO make the namespace prefixes transparant

XML::Parser::default_line_numbers=true

results_doc = XML::Document.file('output.xml')
instance_doc = XML::Document.file('instances/Example2.xml')

locations = results_doc.root.find('//svrl:failed-assert').map do |assert|
i_node = instance_doc.root.find_first assert['location']

assert.find('svrl:text/text()').each do |message|
puts '%s "%s" on line %d: %s' % [i_node.node_type_name,
i_node.name,
i_node.line_num,
message.content.strip]
end

end

0 comments on commit 4e106a0

Please sign in to comment.