Sha256: 7de4a04df903bd7442495d9007b07e959ca42411f2b60d248324c215fbd85503

Contents?: true

Size: 622 Bytes

Versions: 17

Compression:

Stored size: 622 Bytes

Contents

module HealthDataStandards
  module Validate
    module Schema
      class Validator
        include BaseValidator

        def initialize(name, schema_file)
          @name = name
          @schema_file = schema_file
          @xsd = Nokogiri::XML::Schema(File.new(@schema_file))
        end

        # Validate the document against the configured schema
        def validate(document,data={})
          @xsd.errors.clear
          doc = get_document(document)
          @xsd.validate(doc).map do |error|
            build_error(error.message, "/", data[:file_name])
          end
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

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