Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

ruby xml lib tool for text reporting

  • Loading branch information...
commit 4e106a0efaf9086b32c02d4bd332280972b127c5 1 parent 93e384d
Francesco Lazzarino authored
Showing with 24 additions and 0 deletions.
  1. +24 −0 bin/validate2.rb
View
24 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
Please sign in to comment.
Something went wrong with that request. Please try again.