Module: Dcc::Validate::Xsd
- Defined in:
- lib/dcc/validate/xsd.rb
Overview
Dcc::Validate::Xsd validates DCC XML against one of the 12 bundled DCC
schema versions. Auto-detects the version from the schemaVersion
attribute when version: is :auto or nil.
Constant Summary collapse
- SCHEMA_CACHE =
rubocop:disable Style/MutableConstant -- populated at runtime
{}
Class Method Summary collapse
Class Method Details
.call(xml, version: :auto) ⇒ Dcc::Validate::Result
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/dcc/validate/xsd.rb', line 26 def call(xml, version: :auto) resolved = ::Dcc::Schema::Version.resolve_dcc(version, xml: xml) schema = schema_for(resolved) doc = parse_xml(xml) errors = schema.validate(doc).map { |e| issue_from_nokogiri(e, resolved) } ::Dcc::Validate::Result.new( issues: errors, schema_version: resolved, source: "xsd", ) end |