FMI 3.0 validation fails to validate Enumeration with Annotations in libxml2
t-sommer opened this issue · comments
Torsten Sommer commented
The validation of the following XML fails in libxml2
2.11.5 using the current schema
<Enumeration
name="world.gravityType"
valueReference="100663316"
description="Type of gravity field"
variability="constant"
declaredType="Modelica.Mechanics.MultiBody.Types.GravityTypes"
start="2">
<Annotations>
<Annotation
type="com.3ds.dymola">
<DeclarationOrder
order="36"/>
</Annotation>
</Annotations>
</Enumeration>
with
ERROR (line 612, column 0): Element 'Annotations': This element is not expected. Expected is ( Alias ).
This seems to be related to the following definition in fmi3Variable.xsd
.
<xs:complexType name="fmi3MandatorilyTypedArrayableVariable" abstract="true">
<xs:complexContent>
<xs:restriction base="fmi3TypedArrayableVariable">
<xs:attribute name="declaredType" type="xs:normalizedString" use="required"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
The validation succeeds when changing it to
<xs:complexType name="fmi3MandatorilyTypedArrayableVariable" abstract="true">
<xs:complexContent>
<xs:extension base="fmi3TypedArrayableVariable">
<!-- <xs:attribute name="declaredType" type="xs:normalizedString" use="required"/>-->
</xs:extension>
</xs:complexContent>
</xs:complexType>
Torsten Sommer commented
@pmai, do you think this is a bug in libxml2?
Torsten Sommer commented
A possible workaround would be to let fmi3Enumeration
extend fmi3TypedArrayableVariable
directly and check for the declaredType
attribute programmatically.
Pierre R. Mai commented
Pierre R. Mai commented
I.e. in current head (and hence 3.0.1, i guess) the schema for fmi3MandatorilyTypedArrayableVariable
is
<xs:complexType name="fmi3MandatorilyTypedArrayableVariable" abstract="true">
<xs:complexContent>
<xs:restriction base="fmi3TypedArrayableVariable">
<xs:sequence>
<xs:element ref="Annotations" minOccurs="0"/>
<xs:group ref="fmi3Dimensions"/>
</xs:sequence>
<xs:attribute name="declaredType" type="xs:normalizedString" use="required"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
and not
<xs:complexType name="fmi3MandatorilyTypedArrayableVariable" abstract="true">
<xs:complexContent>
<xs:restriction base="fmi3TypedArrayableVariable">
<xs:attribute name="declaredType" type="xs:normalizedString" use="required"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
as it was for 3.0.0...