class HealthDataStandards::Validate::Schema::Validator
Public Class Methods
new(name, schema_file)
click to toggle source
# File lib/health-data-standards/validate/schema_validator.rb, line 7 def initialize(name, schema_file) @name = name @schema_file = schema_file @xsd = Nokogiri::XML::Schema(File.new(@schema_file)) end
Public Instance Methods
validate(document,data={})
click to toggle source
Validate
the document against the configured schema
# File lib/health-data-standards/validate/schema_validator.rb, line 14 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