'Unable to validate XML against XSD schema
I am working on a Python project where we have a function generating an XML Schema from data gathered from different sources. The main objective is not to validate the output of this function using an authoritative schema (namely https://github.com/ietf-tools/xml2rfc/blob/main/xml2rfc/data/v3.rnc).
The official authoritative schema is in Relax NG Compact (RNC) format. Thus, I converted this schema into an XSD schema using the trang official converter tool.
During conversion of the schema, the following warning message is shown:
xml2rfc/xml2rfc/data/v3.rnc:495:45: warning: cannot represent an optional group of attributes; approximating
Now, I used an online validator to validate the XSD obtained using trang, which confirms that XSD is syntactically correct.
If, however, using the same tool I try to validate an XML file, the following error messages are raised:
- Element '{http://www.w3.org/2001/XMLSchema}attributeGroup', attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}base' does not resolve to a(n) attribute group definition.
- Element '{http://www.w3.org/2001/XMLSchema}attributeGroup', attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute group definition.
- Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'ref': The QName value '{http://www.w3.org/2000/svg}svg' does not resolve to a(n) element declaration.
Same thing happens when I try to parse the XSD schema using the lxml python library.
Does anyone have any idea how these issues can be addressed?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
