8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/asciidoctor/rfc/common/validate.rb', line 8
def validate(doc, filename)
schema = Jing.new(filename)
File.write(".tmp.xml", doc.to_xml)
begin
errors = schema.validate(".tmp.xml")
rescue Jing::Error => e
abort "[metanorma-ietf] Validation error: #{e}"
end
if errors.none?
warn "[metanorma-ietf] Validation passed."
else
errors.each do |error|
warn "[metanorma-ietf] #{error[:message]} @ #{error[:line]}:#{error[:column]}"
end
end
end
|