Sha256: 45548014ee53cd99f0d1ca5a1bd854f4f8fdd4b9b4046984e036c14c61846f0e

Contents?: true

Size: 697 Bytes

Versions: 1

Compression:

Stored size: 697 Bytes

Contents

#!/usr/bin/ruby

require 'libxml'
require 'schematron'

include LibXML

if ARGV.size != 2
  $stderr.puts "usage: validate [schematron] [instance]"
  exit 1
end

# use the line numbers
XML.default_line_numbers = true

# Get sch and xml from command line
schema_doc = XML::Document.file ARGV[0]
instance_doc = XML::Document.file ARGV[1]

stron = Schematron::Schema.new schema_doc
stron.validate(instance_doc).each do |error|
  puts '%s "%s" on line %d: %s' % [
                                   error[:type],
                                   error[:name],
                                   error[:line],
                                   error[:message]
                                  ]
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
schematron-0.0.0 bin/validate