Is XSD validation with substitution groups supported?

15 views
Skip to first unread message

Lars Vonk

unread,
Jun 12, 2020, 1:20:52 PM6/12/20
to nokogiri-talk
Hi,

I am trying to validate an xml file against an XSD that makes use of substitution groups but can't get it to work. It keeps failing on the first substitution it finds and reports that the element is not expected. Since that is a substitutiongroup I suspect it has something to do with it, so my question is if this is supposed to work?

Ruby code:

require 'nokogiri'
xsd = File.open('./xbrl-instance-2003-12-31.xsd')
schema = Nokogiri::XML::Schema(xsd)
xml_document = File.open('./VB-01_bd-rpt-ob-aangifte-2020.xbrl')
doc = Nokogiri::XML(xml_document) do |config|
   config.strict.nonet
   config.noblanks
end
# puts doc.to_xml(indent: 2)
result = schema.validate(doc)
puts
result

I attached the relevant files, put xbrl-instance-2003-12-31.xsd in the same directory as xbrl-linkbase-2003-12-31.xsd, xl-2003-12-31.xsd and xlink-2003-12-31.xsd

We are using nokogiri 1.10.9 and ruby 2.6.5

Thanks in advance,
Lars

xlink-2003-12-31.xsd
xbrl-linkbase-2003-12-31.xsd
xbrl-instance-2003-12-31.xsd
VB-01_bd-rpt-ob-aangifte-2020.xbrl
xl-2003-12-31.xsd
Reply all
Reply to author
Forward
0 new messages