GNOME Bugzilla – Bug 596875
xmllint/libxml2 handling of multiple XSDs
Last modified: 2021-07-05 13:27:11 UTC
If you have a schema which allows extensions (i.e. with <any> or <anyAttribute> in it somewhere) then it seems xmllint (and possibly libxml2) cannot handle multiple schemas. Is this just an error in the way I invoke it, bad defintion of my XSD/XML or a new feature requirement? I don't want to use skip validation as I want the extra attribs to be tightly controlled too. I don't own the main/core XSD hence the extension using my custom XSD. header of XML = "<?xml version="1.0" encoding="UTF-8"?> <SERVICE_PLUGIN xmlns="xxx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sfbu="yyy" xsi:schemaLocation="xxx file:/home/sg/dev/ACPtools/XSD/AE_2.3/ServicePlugin.xsd yyy file:/home/sg/dev/ACPtools/XSD/AE_2.3/SFBUCustomAttribs.xsd" >" Extract of element where I tried to add custom attribs = " <PARAM_DEFINITION PARAM_NAME="SP1.GAT1.GP.PD2" PARAM_TYPE="number" sfbu:MinValue="x" MaxValue="7" />" (tried with/without namespace prefix) Copy of custom XSD used by XML above = "<?xml version="1.0" encoding="ISO-8859-1"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="yyy" xmlns="yyy" elementFormDefault="qualified"> <xs:attribute name="MinValue"> <xs:simpleType> <xs:restriction base="xs:integer"> <xs:minInclusive value="0"/> </xs:restriction> </xs:simpleType> </xs:attribute> <xs:attribute name="MaxValue"> <xs:simpleType> <xs:restriction base="xs:integer" /> <xs:minInclusive value="1"/> </xs:restriction> </xs:simpleType> </xs:attribute> </xs:schema>" test output = "xmllint --noout --schema file:/home/sg/dev/ACPtools/XSD/AE_2.3/ServicePlugin.xsd SP_test1.xml SP_test1.xml:82: element PARAM_DEFINITION: Schemas validity error : Element '{http://www.cramer.com/ServicePluginSchema}PARAM_DEFINITION', attribute '{http://www.amdocs.com/SFBU}MinValue': No matching global attribute declaration available, but demanded by the strict wildcard. SP_test1.xml:82: element PARAM_DEFINITION: Schemas validity error : Element '{http://www.cramer.com/ServicePluginSchema}PARAM_DEFINITION', attribute 'MaxValue': No matching global attribute declaration available, but demanded by the strict wildcard. SP_test1.xml fails to validate" Env Info xmllint: using libxml version 20632 compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 FTP HTTP DTDValid HTML Legacy C14N Catalog XPath XPointer XInclude Iconv ISO8859X Unicode Regexps Automata Expr Schemas Schematron Modules Debug Zlib Kernel: Linux 2.6.28-15-generic x86_64
typo: <PARAM_DEFINITION PARAM_NAME="SP1.GAT1.GP.PD2" PARAM_TYPE="number" sfbu:MinValue="x" MaxValue="7" /> should read sfbu:MinValue="1", but it doesn't affect the outcome as XSD can't be found/referenced.
typo #2 (sigh), <xs:restriction base="xs:integer" /> has a closing slash (cut'n'paste error). Again doesn't materially affect the issue as I retested and got the same error.
Note that whatever validator is used by oXygen v10.3.0 works (i.e. can handle multiple schemas).
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.