-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
documentation element: character data between child elements not allowed #390
Comments
For reference, the error comes from xmlschema/xmlschema/validators/groups.py Line 921 in e0ff225
|
Hi, >>> import xmlschema
>>> xs = xmlschema.XMLSchema11("nxdlTypes.xsd", validation='lax')
>>> len(xs.all_errors)
33 despite the errors the schema instance should be usable for validating XML data. thank you |
The matter is with: <xs:element name="example">rad</xs:element> and similar tags inside xs:documentation elements. That is actually an invalid element declaration because an xs:element cannot contain character data. Probably many validators don't check the tags inside xs:documentation but this could be incorrect because the content of xs:documentation is a lax wildcard, so the well-know elements in its content must be valid (this is for sure the case of an xs:element). This is the XSD meta-schema part that declare an xs:documentation element: <xs:element name="documentation" id="documentation">
<xs:annotation>
<xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-documentation"/>
</xs:annotation>
<xs:complexType mixed="true">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:any processContents="lax"/>
</xs:sequence>
<xs:attribute name="source" type="xs:anyURI"/>
<xs:attribute ref="xml:lang"/>
<xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:complexType>
</xs:element> Changing the processing of lax wildcards for this is not possible. Introducing another option for handling xs:documentation sections in a special mode is bad. Consider that this library is used also for decoding, not only for validation. So if there aren't other evidences that force the interpretation of xs:documentation section as a skip wildcard instead of a lax wildcard the only option is to fix your schema (nxdlTypes.xsd) or use the workaround that i suggested above. P.S.: also the schema validator embedded in my IDE (PyCharm) reports nxdlTypes.xsd schema as invalid: |
I totally misinterpreted the validation error. It is not the presence of an |
I'm trying to use xmlschema and found a validation error which we don't get with
lxml
(see nexusformat/definitions#1368)The issue is this
The docs https://www.w3schools.com/xml/el_documentation.asp say that
I'm not sure what
Any well-formed XML content
means but inxmlschema
it means either plain text or children, not both? Can anyone provide additional context? I'm not that familiar with XMLSchema.The text was updated successfully, but these errors were encountered: