I am using QT 5.12 to validate and parse XML files.
I have the following complex type, which works fine:
<xs:complexType name="startDefn">
<xs:sequence>
<xs:element ref="testsuite:obj"/>
<xs:element minOccurs="0" ref="testsuite:starfile"/>
<xs:element minOccurs="0" ref="testsuite:firfile"/>
<xs:element minOccurs="0" ref="testsuite:funcfile"/>
</xs:sequence>
</xs:complexType>
However, I need to extend it by adding a new complex type. I'd like the final addition which needs to specify 2 files to look like this in the XML: (having is optional, but if it is present both the files should be specified)
<start>
<obj>src/models/test.obj</obj>
<regulation>
<start>testing/Test8/example.out.0</start>
<end>testing/Test8/example.out.1</end>
</regulation>
</start>
So I tried modifying the schema like the following:
<xs:complexType name="startDefn">
<xs:sequence>
<xs:element ref="testsuite:obj"/>
<xs:element minOccurs="0" ref="testsuite:starfile"/>
<xs:element minOccurs="0" ref="testsuite:firfile"/>
<xs:element minOccurs="0" ref="testsuite:funcfile"/>
<xs:complexType name="regulation" minOccurs="0">
<xs:sequence>
<xs:element minOccurs="1" ref="testsuite:start"/>
<xs:element minOccurs="1" ref="testsuite:end"/>
</xs:sequence>
</xs:complexType>
</xs:sequence>
</xs:complexType>
But when I try to validate my file after adding this change to the schema, QXmlSchemaValidator::validate() segfaults. I cannot see into the QT code to see exactly where.
I have also tried:
- Removing the
sequence, so just elements directly inside the complex element - Removing the minOccurs from the complexType
- Wrapping the complexType in an element
I'm not very familiar with XML or schema, so any help is appreciated.
(I am not able to post the full schema here)
This may not be too helpful to others, but I was actually supposed to be modifying a .rnc file and using it to create a schema using Trang.
The changes it made were too complex to just put it here. Trying to modify the schema by hand was a mistake.