Sha256: 1ecdb9c02353797fd7ad236b60a5442b4b109d4db88e371ef4894f84736b2d6d

Contents?: true

Size: 1.26 KB

Versions: 16

Compression:

Stored size: 1.26 KB

Contents

module HealthDataStandards
  module Validate
    module Schematron
    NAMESPACE = {"svrl" => "http://purl.oclc.org/dsdl/svrl"}
    DIR = File.expand_path("../../../../", __FILE__)
    ISO_SCHEMATRON = File.join(DIR, 'resources/schematron/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl')

      class Validator
        include BaseValidator

        if RUBY_PLATFORM != "java"
          require_relative "schematron/c_processor"
          include Schematron::CProcessor
        else
          require_relative 'schematron/java_processor'
          include Schematron::JavaProcessor
        end

        def initialize(name,schematron_file)
          @name = name
          @schematron_file = schematron_file
        end

        def validate(document,data = {})
          file_errors = document.errors.select { |e| e.fatal? || e.error? }
          if file_errors
            file_errors.each do |error|
              build_error(error, '/', data[:file_name])
            end
          end
          errors = get_errors(document).root.xpath("//svrl:failed-assert",NAMESPACE).map do |el|
            build_error(el.xpath('svrl:text',NAMESPACE).text, el['location'], data[:file_name])
          end
          errors.uniq{|e| "#{e.location}#{e.message}"}
        end

      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
health-data-standards-4.3.5 lib/health-data-standards/validate/schematron_validator.rb
health-data-standards-4.3.4 lib/health-data-standards/validate/schematron_validator.rb
health-data-standards-4.3.3 lib/health-data-standards/validate/schematron_validator.rb
health-data-standards-4.3.2 lib/health-data-standards/validate/schematron_validator.rb
health-data-standards-4.3.1 lib/health-data-standards/validate/schematron_validator.rb
health-data-standards-4.3.0 lib/health-data-standards/validate/schematron_validator.rb
health-data-standards-4.2.0 lib/health-data-standards/validate/schematron_validator.rb
health-data-standards-4.1.0 lib/health-data-standards/validate/schematron_validator.rb
health-data-standards-4.0.6 lib/health-data-standards/validate/schematron_validator.rb
health-data-standards-4.0.5 lib/health-data-standards/validate/schematron_validator.rb
health-data-standards-4.0.4 lib/health-data-standards/validate/schematron_validator.rb
health-data-standards-4.0.3 lib/health-data-standards/validate/schematron_validator.rb
health-data-standards-4.0.2 lib/health-data-standards/validate/schematron_validator.rb
health-data-standards-4.0.1 lib/health-data-standards/validate/schematron_validator.rb
health-data-standards-4.0.0 lib/health-data-standards/validate/schematron_validator.rb
health-data-standards-3.7.0 lib/health-data-standards/validate/schematron_validator.rb