GNOME Bugzilla – Bug 763866
schema using redefine and indirect include fails to parse
Last modified: 2021-07-05 13:25:14 UTC
Created attachment 324256 [details] files to reproduce refefime+indirect include problem Fails in versions 2.9.1, 2.9.2 (did not try git master). Attached is a ZIP with a minimal repro (distilled from a huge production schema). It still involves 4 separate files - could not make it smaller, sorry. fruits-xt.xsd <- loading this as a schema fails. It uses "redefine" to extend two types: Apple and Orange. fruits.xsd <- base schema - does not do much, uses "include" to load "types.xsd" types.xds <- does nothing but includes types-extra.xsd, where Apple and Orange are defined types-extra.xsd <- this is where datatypes Apple and Orange are actually defined Error: $ xmllint --schema fruits-xt.xsd blah fruits-xt.xsd:19: element complexType: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}complexType': The complex type definition '{http://garden.org/fruits}Orange' to be redefined could not be found in the redefined schema. types-extra.xsd:9: element complexType: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}complexType': A global complex type definition '{http://garden.org/fruits}Orange' does already exist. WXS schema fruits-xt.xsd failed to compile warning: failed to load external entity "blah" Experiments: 1. if I make fruits.xsd include "types-extra.xsd" directly, no error 2. if I swap redefinitions in fruits-xt.xsd, will get similar message about Apple. Looks like parser sees only the first data type declared in a file that is indirectly included. FYI: Coming from LXML bug tracker: https://bugs.launchpad.net/lxml/+bug/1557710
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new ticket at https://gitlab.gnome.org/GNOME/libxml2/-/issues/ Thank you for your understanding and your help.