Sha256: 3a506286ef5023634db5c5f75c70d3f8c19aaa8c3cfb3d92d3fea5d3ebfdc60f
Contents?: true
Size: 590 Bytes
Versions: 15
Compression:
Stored size: 590 Bytes
Contents
# frozen_string_literal: true module CqmValidators 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
Version data entries
15 entries across 15 versions & 1 rubygems