Skip to content

Fix invalid xs:import of fmi3Annotation.xsd - #8

Open
hubertus65 wants to merge 1 commit into
mainfrom
fix/xs-import-annotation
Open

hubertus65 wants to merge 1 commit into
mainfrom
fix/xs-import-annotation

Conversation

@hubertus65

Copy link
Copy Markdown
Member

Summary

maHarmonizedSpecificationExperiments.xsd pulled in fmi3Annotation.xsd via xs:import with no namespace attribute:

<xs:import schemaLocation="https://raw.githubusercontent.com/modelica/fmi-standard/main/schema/fmi3Annotation.xsd"/>

Neither this schema nor fmi3Annotation.xsd declares a targetNamespace — both are in "no namespace". Per XSD 1.0 (§4.2.3), xs:import is for pulling in components from a different namespace than the importing schema; merging components from a schema with the same (or absent) target namespace is what xs:include is for. xs:import without a namespace attribute, used by a schema that itself has no target namespace, is not spec-conformant.

Lenient validators (libxml2/xmllint, many IDEs) tolerate this, which is presumably why it went unnoticed, but strict tooling rejects the schema outright — e.g. the Python xmlschema library fails to even load it:

XMLSchemaParseError: if the 'namespace' attribute is not present on the import statement then the imported schema must have a 'targetNamespace'

Fix: xs:importxs:include for this one line (xs:include takes no namespace attribute).

Closes #7

Test plan

  • Confirmed the schema and example manifest validate successfully with the strict Python xmlschema library after the change (previously failed to even load the schema)

Neither this schema nor fmi3Annotation.xsd declares a targetNamespace,
so both are in "no namespace". xs:import is for pulling in components
from a different namespace than the importing schema; merging
components from a schema with the same (or absent) target namespace
is what xs:include is for. Using xs:import without a namespace
attribute here is not spec-conformant, and rejected outright by
strict validators (e.g. the Python xmlschema library), even though
lenient ones (libxml2/xmllint) tolerate it.

Closes #7
@AnHeuermann

AnHeuermann commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

I recommend to merge #10 before merging this to see in the CI that the XML is valid with this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

xs:import of fmi3Annotation.xsd is invalid per XSD 1.0 (should be xs:include)

2 participants