Fix issues with XSD schemas.

This commit is contained in:
Roman Telezhynskyi 2023-02-10 14:14:43 +02:00
parent c0deb4d27a
commit 3a88048952
55 changed files with 617 additions and 217 deletions

View File

@ -41,7 +41,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^\-()+=?:;'\\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^\-()+=?:;\\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^\-()+=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^\-()+=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="formatVersion"> <xs:simpleType name="formatVersion">

View File

@ -42,7 +42,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="formatVersion"> <xs:simpleType name="formatVersion">

View File

@ -44,7 +44,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="formatVersion"> <xs:simpleType name="formatVersion">

View File

@ -45,7 +45,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="formatVersion"> <xs:simpleType name="formatVersion">

View File

@ -43,7 +43,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="units"> <xs:simpleType name="units">

View File

@ -82,7 +82,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="units"> <xs:simpleType name="units">

View File

@ -94,7 +94,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="units"> <xs:simpleType name="units">

View File

@ -95,7 +95,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="units"> <xs:simpleType name="units">

View File

@ -96,7 +96,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="units"> <xs:simpleType name="units">

View File

@ -96,7 +96,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="units"> <xs:simpleType name="units">

View File

@ -757,7 +757,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="units"> <xs:simpleType name="units">

View File

@ -760,7 +760,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="units"> <xs:simpleType name="units">

View File

@ -763,7 +763,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="units"> <xs:simpleType name="units">

View File

@ -773,7 +773,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="units"> <xs:simpleType name="units">

View File

@ -751,7 +751,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="units"> <xs:simpleType name="units">

View File

@ -754,7 +754,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="units"> <xs:simpleType name="units">

View File

@ -754,7 +754,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="units"> <xs:simpleType name="units">

View File

@ -755,7 +755,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="units"> <xs:simpleType name="units">

View File

@ -776,7 +776,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="units"> <xs:simpleType name="units">

View File

@ -791,7 +791,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="units"> <xs:simpleType name="units">

View File

@ -775,7 +775,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="uuid"> <xs:simpleType name="uuid">

View File

@ -780,7 +780,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="uuid"> <xs:simpleType name="uuid">

View File

@ -781,7 +781,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="uuid"> <xs:simpleType name="uuid">

View File

@ -781,7 +781,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="uuid"> <xs:simpleType name="uuid">

View File

@ -795,7 +795,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="units"> <xs:simpleType name="units">

View File

@ -801,7 +801,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="units"> <xs:simpleType name="units">

View File

@ -801,7 +801,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="units"> <xs:simpleType name="units">

View File

@ -841,7 +841,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="units"> <xs:simpleType name="units">

View File

@ -827,7 +827,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="units"> <xs:simpleType name="units">

View File

@ -829,7 +829,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="units"> <xs:simpleType name="units">

View File

@ -761,7 +761,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="uuid"> <xs:simpleType name="uuid">

View File

@ -767,7 +767,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="uuid"> <xs:simpleType name="uuid">

View File

@ -808,7 +808,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="uuid"> <xs:simpleType name="uuid">
@ -836,7 +836,7 @@
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="contentType"> <xs:simpleType name="contentType">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="image\/[-\w]+(\.[-\w]+)*([+][-\w]+)?"/> <xs:pattern value="image\\/[-\w]+(\.[-\w]+)*([+][-\w]+)?"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="colors"> <xs:simpleType name="colors">

View File

@ -817,7 +817,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="uuid"> <xs:simpleType name="uuid">
@ -845,7 +845,7 @@
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="contentType"> <xs:simpleType name="contentType">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="image\/[-\w]+(\.[-\w]+)*([+][-\w]+)?"/> <xs:pattern value="image\\/[-\w]+(\.[-\w]+)*([+][-\w]+)?"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="colors"> <xs:simpleType name="colors">

View File

@ -822,12 +822,12 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\\&quot;]){1,1}([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="pieceShortName"> <xs:simpleType name="pieceShortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Zs}*\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Zs}*\\/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="uuid"> <xs:simpleType name="uuid">
@ -855,7 +855,7 @@
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="contentType"> <xs:simpleType name="contentType">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="image\/[-\w]+(\.[-\w]+)*([+][-\w]+)?"/> <xs:pattern value="image\\/[-\w]+(\.[-\w]+)*([+][-\w]+)?"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="colors"> <xs:simpleType name="colors">

View File

@ -240,12 +240,11 @@ void VAbstractConverter::ValidateXML(const QString &schema) const
throw VException(errorMsg); throw VException(errorMsg);
} }
VParserErrorHandler messageHandler;
QXmlSchema sch; QXmlSchema sch;
sch.setMessageHandler(&messageHandler); sch.setMessageHandler(&parserErrorHandler);
if (sch.load(&fileSchema, QUrl::fromLocalFile(fileSchema.fileName()))==false) if (sch.load(&fileSchema, QUrl::fromLocalFile(fileSchema.fileName()))==false)
{ {
VException e(messageHandler.StatusMessage()); VException e(parserErrorHandler.StatusMessage());
e.AddMoreInformation(tr("Could not load schema file '%1'.").arg(fileSchema.fileName())); e.AddMoreInformation(tr("Could not load schema file '%1'.").arg(fileSchema.fileName()));
throw e; throw e;
} }
@ -267,9 +266,9 @@ void VAbstractConverter::ValidateXML(const QString &schema) const
if (errorOccurred) if (errorOccurred)
{ {
VException e(messageHandler.StatusMessage()); VException e(parserErrorHandler.StatusMessage());
e.AddMoreInformation(tr("Validation error file %3 in line %1 column %2").arg(messageHandler.Line()) e.AddMoreInformation(tr("Validation error file %3 in line %1 column %2").arg(parserErrorHandler.Line())
.arg(messageHandler.Column()).arg(m_originalFileName)); .arg(parserErrorHandler.Column()).arg(m_originalFileName));
throw e; throw e;
} }
#endif // QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #endif // QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
@ -360,3 +359,15 @@ void VAbstractConverter::SetVersion(const QString &version)
throw e; throw e;
} }
} }
//---------------------------------------------------------------------------------------------------------------------
QString VAbstractConverter::XSDSchema(unsigned int ver) const
{
const QHash <unsigned, QString> schemas = Schemas();
if (schemas.contains(ver))
{
return schemas.value(ver);
}
InvalidVersion(ver);
}

View File

@ -36,7 +36,6 @@
#include <QtGlobal> #include <QtGlobal>
#include "vdomdocument.h" #include "vdomdocument.h"
#include "../vmisc/projectversion.h"
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wsuggest-final-types") QT_WARNING_DISABLE_GCC("-Wsuggest-final-types")
@ -69,12 +68,14 @@ protected:
virtual QString MinVerStr() const =0; virtual QString MinVerStr() const =0;
virtual QString MaxVerStr() const =0; virtual QString MaxVerStr() const =0;
virtual QString XSDSchema(unsigned ver) const =0; virtual QString XSDSchema(unsigned ver) const;
virtual void ApplyPatches() =0; virtual void ApplyPatches() =0;
virtual void DowngradeToCurrentMaxVersion() =0; virtual void DowngradeToCurrentMaxVersion() =0;
virtual bool IsReadOnly() const =0; virtual bool IsReadOnly() const =0;
virtual auto Schemas() const -> QHash <unsigned, QString> =0;
void Replace(QString &formula, const QString &newName, vsizetype position, const QString &token, void Replace(QString &formula, const QString &newName, vsizetype position, const QString &token,
vsizetype &bias) const; vsizetype &bias) const;
void CorrectionsPositions(vsizetype position, vsizetype bias, QMap<vsizetype, QString> &tokens) const; void CorrectionsPositions(vsizetype position, vsizetype bias, QMap<vsizetype, QString> &tokens) const;

View File

@ -51,6 +51,17 @@ VLabelTemplateConverter::VLabelTemplateConverter(const QString &fileName)
ValidateInputFile(CurrentSchema); ValidateInputFile(CurrentSchema);
} }
//---------------------------------------------------------------------------------------------------------------------
auto VLabelTemplateConverter::XSDSchemas() -> QHash<unsigned int, QString>
{
static const auto schemas = QHash <unsigned, QString>
{
std::make_pair(FormatVersion(1, 0, 0), CurrentSchema)
};
return schemas;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
unsigned VLabelTemplateConverter::MinVer() const unsigned VLabelTemplateConverter::MinVer() const
{ {
@ -75,20 +86,6 @@ QString VLabelTemplateConverter::MaxVerStr() const
return LabelTemplateMaxVerStr; return LabelTemplateMaxVerStr;
} }
//---------------------------------------------------------------------------------------------------------------------
QString VLabelTemplateConverter::XSDSchema(unsigned ver) const
{
switch (ver)
{
case (FormatVersion(1, 0, 0)):
return CurrentSchema;
default:
InvalidVersion(ver);
break;
}
return QString();//unreachable code
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VLabelTemplateConverter::ApplyPatches() void VLabelTemplateConverter::ApplyPatches()
{ {
@ -108,3 +105,9 @@ void VLabelTemplateConverter::DowngradeToCurrentMaxVersion()
SetVersion(LabelTemplateMaxVerStr); SetVersion(LabelTemplateMaxVerStr);
Save(); Save();
} }
//---------------------------------------------------------------------------------------------------------------------
auto VLabelTemplateConverter::Schemas() const -> QHash<unsigned int, QString>
{
return XSDSchemas();
}

View File

@ -30,6 +30,7 @@
#define VLABELTEMPLATECONVERTER_H #define VLABELTEMPLATECONVERTER_H
#include "vabstractconverter.h" #include "vabstractconverter.h"
#include "../vmisc/projectversion.h"
class VLabelTemplateConverter : public VAbstractConverter class VLabelTemplateConverter : public VAbstractConverter
{ {
@ -42,6 +43,8 @@ public:
static Q_DECL_CONSTEXPR const unsigned LabelTemplateMinVer = FormatVersion(1, 0, 0); static Q_DECL_CONSTEXPR const unsigned LabelTemplateMinVer = FormatVersion(1, 0, 0);
static Q_DECL_CONSTEXPR const unsigned LabelTemplateMaxVer = FormatVersion(1, 0, 0); static Q_DECL_CONSTEXPR const unsigned LabelTemplateMaxVer = FormatVersion(1, 0, 0);
static auto XSDSchemas() -> QHash <unsigned, QString>;
protected: protected:
virtual unsigned MinVer() const override; virtual unsigned MinVer() const override;
virtual unsigned MaxVer() const override; virtual unsigned MaxVer() const override;
@ -49,12 +52,13 @@ protected:
virtual QString MinVerStr() const override; virtual QString MinVerStr() const override;
virtual QString MaxVerStr() const override; virtual QString MaxVerStr() const override;
virtual QString XSDSchema(unsigned ver) const override;
virtual void ApplyPatches() override; virtual void ApplyPatches() override;
virtual void DowngradeToCurrentMaxVersion() override; virtual void DowngradeToCurrentMaxVersion() override;
virtual bool IsReadOnly() const override {return false;} virtual bool IsReadOnly() const override {return false;}
auto Schemas() const -> QHash <unsigned, QString> override;
private: private:
Q_DISABLE_COPY_MOVE(VLabelTemplateConverter) // NOLINT Q_DISABLE_COPY_MOVE(VLabelTemplateConverter) // NOLINT
static const QString LabelTemplateMinVerStr; static const QString LabelTemplateMinVerStr;

View File

@ -117,6 +117,20 @@ auto VLayoutConverter::GetFormatVersionStr() const -> QString
return QStringLiteral("0.0.0"); return QStringLiteral("0.0.0");
} }
//---------------------------------------------------------------------------------------------------------------------
auto VLayoutConverter::XSDSchemas() -> QHash<unsigned int, QString>
{
static auto schemas = QHash <unsigned, QString>
{
std::make_pair(FormatVersion(0, 1, 0), QStringLiteral("://schema/layout/v0.1.0.xsd")),
std::make_pair(FormatVersion(0, 1, 1), QStringLiteral("://schema/layout/v0.1.1.xsd")),
std::make_pair(FormatVersion(0, 1, 2), QStringLiteral("://schema/layout/v0.1.2.xsd")),
std::make_pair(FormatVersion(0, 1, 3), CurrentSchema),
};
return schemas;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VLayoutConverter::SetVersion(const QString &version) void VLayoutConverter::SetVersion(const QString &version)
{ {
@ -133,25 +147,6 @@ void VLayoutConverter::SetVersion(const QString &version)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
auto VLayoutConverter::XSDSchema(unsigned ver) const -> QString
{
QHash <unsigned, QString> schemas =
{
std::make_pair(FormatVersion(0, 1, 0), QStringLiteral("://schema/layout/v0.1.0.xsd")),
std::make_pair(FormatVersion(0, 1, 1), QStringLiteral("://schema/layout/v0.1.1.xsd")),
std::make_pair(FormatVersion(0, 1, 2), QStringLiteral("://schema/layout/v0.1.2.xsd")),
std::make_pair(FormatVersion(0, 1, 3), CurrentSchema),
};
if (schemas.contains(ver))
{
return schemas.value(ver);
}
InvalidVersion(ver);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VLayoutConverter::ApplyPatches() void VLayoutConverter::ApplyPatches()
{ {
@ -183,6 +178,12 @@ auto VLayoutConverter::IsReadOnly() const -> bool
return false; return false;
} }
//---------------------------------------------------------------------------------------------------------------------
auto VLayoutConverter::Schemas() const -> QHash<unsigned int, QString>
{
return XSDSchemas();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VLayoutConverter::ConvertPiecesToV0_1_3() void VLayoutConverter::ConvertPiecesToV0_1_3()
{ {

View File

@ -29,6 +29,7 @@
#define VLAYOUTCONVERTER_H #define VLAYOUTCONVERTER_H
#include "vabstractconverter.h" #include "vabstractconverter.h"
#include "../vmisc/projectversion.h"
class QDomElement; class QDomElement;
class QString; class QString;
@ -47,6 +48,8 @@ public:
static Q_DECL_CONSTEXPR const unsigned LayoutMinVer = FormatVersion(0, 1, 0); static Q_DECL_CONSTEXPR const unsigned LayoutMinVer = FormatVersion(0, 1, 0);
static Q_DECL_CONSTEXPR const unsigned LayoutMaxVer = FormatVersion(0, 1, 3); static Q_DECL_CONSTEXPR const unsigned LayoutMaxVer = FormatVersion(0, 1, 3);
static auto XSDSchemas() -> QHash <unsigned, QString>;
protected: protected:
void SetVersion(const QString &version) override; void SetVersion(const QString &version) override;
@ -56,12 +59,13 @@ protected:
auto MinVerStr() const -> QString override; auto MinVerStr() const -> QString override;
auto MaxVerStr() const -> QString override; auto MaxVerStr() const -> QString override;
auto XSDSchema(unsigned ver) const -> QString override;
void ApplyPatches() override; void ApplyPatches() override;
void DowngradeToCurrentMaxVersion() override; void DowngradeToCurrentMaxVersion() override;
auto IsReadOnly() const -> bool override; auto IsReadOnly() const -> bool override;
auto Schemas() const -> QHash <unsigned, QString> override;
void ConvertPiecesToV0_1_3(); void ConvertPiecesToV0_1_3();
void ConvertPathToV0_1_3(QDomElement &node); void ConvertPathToV0_1_3(QDomElement &node);

View File

@ -29,7 +29,7 @@
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString VParserErrorHandler::StatusMessage() const auto VParserErrorHandler::StatusMessage() const -> QString
{ {
QTextDocument doc; QTextDocument doc;
doc.setHtml(m_description); doc.setHtml(m_description);
@ -37,17 +37,23 @@ QString VParserErrorHandler::StatusMessage() const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
qint64 VParserErrorHandler::Line() const auto VParserErrorHandler::Line() const -> qint64
{ {
return m_sourceLocation.line(); return m_sourceLocation.line();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
qint64 VParserErrorHandler::Column() const auto VParserErrorHandler::Column() const -> qint64
{ {
return m_sourceLocation.column(); return m_sourceLocation.column();
} }
//---------------------------------------------------------------------------------------------------------------------
auto VParserErrorHandler::HasError() const -> bool
{
return m_hasError;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void VParserErrorHandler::handleMessage(QtMsgType type, const QString &description, const QUrl &identifier, void VParserErrorHandler::handleMessage(QtMsgType type, const QString &description, const QUrl &identifier,
@ -59,6 +65,7 @@ void VParserErrorHandler::handleMessage(QtMsgType type, const QString &descripti
m_messageType = type; m_messageType = type;
m_description = description; m_description = description;
m_sourceLocation = sourceLocation; m_sourceLocation = sourceLocation;
m_hasError = true;
} }
#else #else

View File

@ -38,17 +38,20 @@ class VParserErrorHandler : public QAbstractMessageHandler
public: public:
VParserErrorHandler() =default; VParserErrorHandler() =default;
QString StatusMessage() const; auto StatusMessage() const -> QString;
qint64 Line() const; auto Line() const -> qint64;
qint64 Column() const; auto Column() const -> qint64;
auto HasError() const -> bool;
protected: protected:
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
virtual void handleMessage(QtMsgType type, const QString &description, void handleMessage(QtMsgType type, const QString &description,
const QUrl &identifier, const QSourceLocation &sourceLocation) override; const QUrl &identifier, const QSourceLocation &sourceLocation) override;
private: private:
QtMsgType m_messageType{}; QtMsgType m_messageType{};
QString m_description{}; QString m_description{};
QSourceLocation m_sourceLocation{}; QSourceLocation m_sourceLocation{};
bool m_hasError{false};
}; };
#else #else
@ -61,16 +64,16 @@ XERCES_CPP_NAMESPACE_USE
class VParserErrorHandler : public ErrorHandler class VParserErrorHandler : public ErrorHandler
{ {
public: public:
QString StatusMessage() const; auto StatusMessage() const -> QString;
XMLFileLoc Line() const; auto Line() const -> XMLFileLoc;
XMLFileLoc Column() const; auto Column() const -> XMLFileLoc;
void warning(const SAXParseException& ex) override; void warning(const SAXParseException& ex) override;
void error(const SAXParseException& ex) override; void error(const SAXParseException& ex) override;
void fatalError(const SAXParseException& ex) override; void fatalError(const SAXParseException& ex) override;
void resetErrors() override; void resetErrors() override;
bool HasError() const; auto HasError() const -> bool;
private: private:
XMLFileLoc m_line{0}; XMLFileLoc m_line{0};

View File

@ -181,25 +181,9 @@ VPatternConverter::VPatternConverter(const QString &fileName)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPatternConverter::Save() auto VPatternConverter::XSDSchemas() -> QHash<unsigned int, QString>
{ {
try static const auto schemas = QHash <unsigned, QString>
{
TestUniqueId();
}
catch (const VExceptionWrongId &e)
{
Q_UNUSED(e)
throw VException(tr("Error no unique id."));
}
VAbstractConverter::Save();
}
//---------------------------------------------------------------------------------------------------------------------
auto VPatternConverter::XSDSchema(unsigned ver) const -> QString
{
QHash <unsigned, QString> schemas =
{ {
std::make_pair(FormatVersion(0, 1, 4), QStringLiteral("://schema/pattern/v0.1.4.xsd")), std::make_pair(FormatVersion(0, 1, 4), QStringLiteral("://schema/pattern/v0.1.4.xsd")),
std::make_pair(FormatVersion(0, 2, 0), QStringLiteral("://schema/pattern/v0.2.0.xsd")), std::make_pair(FormatVersion(0, 2, 0), QStringLiteral("://schema/pattern/v0.2.0.xsd")),
@ -271,12 +255,23 @@ auto VPatternConverter::XSDSchema(unsigned ver) const -> QString
std::make_pair(FormatVersion(0, 9, 2), CurrentSchema) std::make_pair(FormatVersion(0, 9, 2), CurrentSchema)
}; };
if (schemas.contains(ver)) return schemas;
}
//---------------------------------------------------------------------------------------------------------------------
void VPatternConverter::Save()
{
try
{ {
return schemas.value(ver); TestUniqueId();
}
catch (const VExceptionWrongId &e)
{
Q_UNUSED(e)
throw VException(tr("Error no unique id."));
} }
InvalidVersion(ver); VAbstractConverter::Save();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -414,6 +409,12 @@ bool VPatternConverter::IsReadOnly() const
return GetParametrBool(pattern, *strReadOnly, falseStr); return GetParametrBool(pattern, *strReadOnly, falseStr);
} }
//---------------------------------------------------------------------------------------------------------------------
auto VPatternConverter::Schemas() const -> QHash<unsigned int, QString>
{
return XSDSchemas();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPatternConverter::ToV0_2_0() void VPatternConverter::ToV0_2_0()
{ {

View File

@ -40,6 +40,7 @@
#include <QtGlobal> #include <QtGlobal>
#include "vabstractconverter.h" #include "vabstractconverter.h"
#include "../vmisc/projectversion.h"
class QDomElement; class QDomElement;
@ -55,6 +56,8 @@ public:
static Q_DECL_CONSTEXPR const unsigned PatternMinVer = FormatVersion(0, 1, 4); static Q_DECL_CONSTEXPR const unsigned PatternMinVer = FormatVersion(0, 1, 4);
static Q_DECL_CONSTEXPR const unsigned PatternMaxVer = FormatVersion(0, 9, 2); static Q_DECL_CONSTEXPR const unsigned PatternMaxVer = FormatVersion(0, 9, 2);
static auto XSDSchemas() -> QHash <unsigned, QString>;
protected: protected:
void Save() override; void Save() override;
@ -64,12 +67,13 @@ protected:
virtual QString MinVerStr() const override; virtual QString MinVerStr() const override;
virtual QString MaxVerStr() const override; virtual QString MaxVerStr() const override;
virtual QString XSDSchema(unsigned ver) const override;
virtual void ApplyPatches() override; virtual void ApplyPatches() override;
virtual void DowngradeToCurrentMaxVersion() override; virtual void DowngradeToCurrentMaxVersion() override;
virtual bool IsReadOnly() const override; virtual bool IsReadOnly() const override;
auto Schemas() const -> QHash <unsigned, QString> override;
private: private:
Q_DISABLE_COPY_MOVE(VPatternConverter) // NOLINT Q_DISABLE_COPY_MOVE(VPatternConverter) // NOLINT
static const QString PatternMinVerStr; static const QString PatternMinVerStr;

View File

@ -76,9 +76,9 @@ VVITConverter::VVITConverter(const QString &fileName)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString VVITConverter::XSDSchema(unsigned ver) const auto VVITConverter::XSDSchemas() -> QHash<unsigned int, QString>
{ {
QHash <unsigned, QString> schemas = static auto schemas = QHash <unsigned, QString>
{ {
std::make_pair(FormatVersion(0, 2, 0), QStringLiteral("://schema/individual_measurements/v0.2.0.xsd")), std::make_pair(FormatVersion(0, 2, 0), QStringLiteral("://schema/individual_measurements/v0.2.0.xsd")),
std::make_pair(FormatVersion(0, 3, 0), QStringLiteral("://schema/individual_measurements/v0.3.0.xsd")), std::make_pair(FormatVersion(0, 3, 0), QStringLiteral("://schema/individual_measurements/v0.3.0.xsd")),
@ -91,14 +91,7 @@ QString VVITConverter::XSDSchema(unsigned ver) const
std::make_pair(FormatVersion(0, 5, 2), CurrentSchema), std::make_pair(FormatVersion(0, 5, 2), CurrentSchema),
}; };
if (schemas.contains(ver)) return schemas;
{
return schemas.value(ver);
}
else
{
InvalidVersion(ver);
}
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -156,6 +149,12 @@ bool VVITConverter::IsReadOnly() const
return UniqueTagText(*strTagRead_Only, falseStr) == trueStr; return UniqueTagText(*strTagRead_Only, falseStr) == trueStr;
} }
//---------------------------------------------------------------------------------------------------------------------
auto VVITConverter::Schemas() const -> QHash<unsigned int, QString>
{
return XSDSchemas();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VVITConverter::AddNewTagsForV0_3_0() void VVITConverter::AddNewTagsForV0_3_0()
{ {

View File

@ -35,7 +35,7 @@
#include <QtGlobal> #include <QtGlobal>
#include "vabstractmconverter.h" #include "vabstractmconverter.h"
#include "vabstractconverter.h" #include "../vmisc/projectversion.h"
class QDomElement; class QDomElement;
@ -51,6 +51,8 @@ public:
static Q_DECL_CONSTEXPR const unsigned MeasurementMinVer = FormatVersion(0, 2, 0); static Q_DECL_CONSTEXPR const unsigned MeasurementMinVer = FormatVersion(0, 2, 0);
static Q_DECL_CONSTEXPR const unsigned MeasurementMaxVer = FormatVersion(0, 5, 2); static Q_DECL_CONSTEXPR const unsigned MeasurementMaxVer = FormatVersion(0, 5, 2);
static auto XSDSchemas() -> QHash <unsigned, QString>;
protected: protected:
virtual unsigned MinVer() const override; virtual unsigned MinVer() const override;
virtual unsigned MaxVer() const override; virtual unsigned MaxVer() const override;
@ -58,11 +60,12 @@ protected:
virtual QString MinVerStr() const override; virtual QString MinVerStr() const override;
virtual QString MaxVerStr() const override; virtual QString MaxVerStr() const override;
virtual QString XSDSchema(unsigned ver) const override;
virtual void ApplyPatches() override; virtual void ApplyPatches() override;
virtual void DowngradeToCurrentMaxVersion() override; virtual void DowngradeToCurrentMaxVersion() override;
virtual bool IsReadOnly() const override; virtual bool IsReadOnly() const override;
auto Schemas() const -> QHash <unsigned, QString> override;
private: private:
Q_DISABLE_COPY_MOVE(VVITConverter) // NOLINT Q_DISABLE_COPY_MOVE(VVITConverter) // NOLINT
static const QString MeasurementMinVerStr; static const QString MeasurementMinVerStr;

View File

@ -73,9 +73,9 @@ VVSTConverter::VVSTConverter(const QString &fileName)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VVSTConverter::XSDSchema(unsigned ver) const -> QString auto VVSTConverter::XSDSchemas() -> QHash<unsigned int, QString>
{ {
QHash <unsigned, QString> schemas = static auto schemas = QHash <unsigned, QString>
{ {
std::make_pair(FormatVersion(0, 3, 0), QStringLiteral("://schema/multisize_measurements/v0.3.0.xsd")), std::make_pair(FormatVersion(0, 3, 0), QStringLiteral("://schema/multisize_measurements/v0.3.0.xsd")),
std::make_pair(FormatVersion(0, 4, 0), QStringLiteral("://schema/multisize_measurements/v0.4.0.xsd")), std::make_pair(FormatVersion(0, 4, 0), QStringLiteral("://schema/multisize_measurements/v0.4.0.xsd")),
@ -90,12 +90,7 @@ auto VVSTConverter::XSDSchema(unsigned ver) const -> QString
std::make_pair(FormatVersion(0, 5, 4), CurrentSchema), std::make_pair(FormatVersion(0, 5, 4), CurrentSchema),
}; };
if (schemas.contains(ver)) return schemas;
{
return schemas.value(ver);
}
InvalidVersion(ver);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -153,6 +148,12 @@ auto VVSTConverter::IsReadOnly() const -> bool
return UniqueTagText(*strTagRead_Only, falseStr) == trueStr; return UniqueTagText(*strTagRead_Only, falseStr) == trueStr;
} }
//---------------------------------------------------------------------------------------------------------------------
auto VVSTConverter::Schemas() const -> QHash<unsigned int, QString>
{
return XSDSchemas();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VVSTConverter::AddNewTagsForV0_4_0() void VVSTConverter::AddNewTagsForV0_4_0()
{ {

View File

@ -35,7 +35,7 @@
#include <QtGlobal> #include <QtGlobal>
#include "vabstractmconverter.h" #include "vabstractmconverter.h"
#include "vabstractconverter.h" #include "../vmisc/projectversion.h"
class QDomElement; class QDomElement;
@ -51,6 +51,8 @@ public:
static Q_DECL_CONSTEXPR const unsigned MeasurementMinVer = FormatVersion(0, 3, 0); static Q_DECL_CONSTEXPR const unsigned MeasurementMinVer = FormatVersion(0, 3, 0);
static Q_DECL_CONSTEXPR const unsigned MeasurementMaxVer = FormatVersion(0, 5, 4); static Q_DECL_CONSTEXPR const unsigned MeasurementMaxVer = FormatVersion(0, 5, 4);
static auto XSDSchemas() -> QHash <unsigned, QString>;
protected: protected:
virtual unsigned MinVer() const override; virtual unsigned MinVer() const override;
virtual unsigned MaxVer() const override; virtual unsigned MaxVer() const override;
@ -58,11 +60,12 @@ protected:
virtual QString MinVerStr() const override; virtual QString MinVerStr() const override;
virtual QString MaxVerStr() const override; virtual QString MaxVerStr() const override;
virtual QString XSDSchema(unsigned ver) const override;
virtual void ApplyPatches() override; virtual void ApplyPatches() override;
virtual void DowngradeToCurrentMaxVersion() override; virtual void DowngradeToCurrentMaxVersion() override;
virtual bool IsReadOnly() const override; virtual bool IsReadOnly() const override;
auto Schemas() const -> QHash <unsigned, QString> override;
private: private:
Q_DISABLE_COPY_MOVE(VVSTConverter) // NOLINT Q_DISABLE_COPY_MOVE(VVSTConverter) // NOLINT
static const QString MeasurementMinVerStr; static const QString MeasurementMinVerStr;

View File

@ -52,6 +52,18 @@ VWatermarkConverter::VWatermarkConverter(const QString &fileName)
ValidateInputFile(CurrentSchema); ValidateInputFile(CurrentSchema);
} }
//---------------------------------------------------------------------------------------------------------------------
auto VWatermarkConverter::XSDSchemas() -> QHash<unsigned int, QString>
{
static auto schemas = QHash <unsigned, QString>
{
std::make_pair(FormatVersion(1, 0, 0), QStringLiteral("://schema/watermark/v1.0.0.xsd")),
std::make_pair(FormatVersion(1, 1, 0), CurrentSchema)
};
return schemas;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
unsigned VWatermarkConverter::MinVer() const unsigned VWatermarkConverter::MinVer() const
{ {
@ -76,23 +88,6 @@ QString VWatermarkConverter::MaxVerStr() const
return WatermarkMaxVerStr; return WatermarkMaxVerStr;
} }
//---------------------------------------------------------------------------------------------------------------------
QString VWatermarkConverter::XSDSchema(unsigned ver) const
{
QHash <unsigned, QString> schemas =
{
std::make_pair(FormatVersion(1, 0, 0), QStringLiteral("://schema/watermark/v1.0.0.xsd")),
std::make_pair(FormatVersion(1, 1, 0), CurrentSchema)
};
if (schemas.contains(ver))
{
return schemas.value(ver);
}
InvalidVersion(ver);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VWatermarkConverter::ApplyPatches() void VWatermarkConverter::ApplyPatches()
{ {
@ -116,6 +111,12 @@ void VWatermarkConverter::DowngradeToCurrentMaxVersion()
Save(); Save();
} }
//---------------------------------------------------------------------------------------------------------------------
auto VWatermarkConverter::Schemas() const -> QHash<unsigned int, QString>
{
return XSDSchemas();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VWatermarkConverter::ToV1_1_0() void VWatermarkConverter::ToV1_1_0()
{ {

View File

@ -29,6 +29,7 @@
#define VWATERMARKCONVERTER_H #define VWATERMARKCONVERTER_H
#include "vabstractconverter.h" #include "vabstractconverter.h"
#include "../vmisc/projectversion.h"
class VWatermarkConverter final : public VAbstractConverter class VWatermarkConverter final : public VAbstractConverter
{ {
@ -41,6 +42,8 @@ public:
static Q_DECL_CONSTEXPR const unsigned WatermarkMinVer = FormatVersion(1, 0, 0); static Q_DECL_CONSTEXPR const unsigned WatermarkMinVer = FormatVersion(1, 0, 0);
static Q_DECL_CONSTEXPR const unsigned WatermarkMaxVer = FormatVersion(1, 1, 0); static Q_DECL_CONSTEXPR const unsigned WatermarkMaxVer = FormatVersion(1, 1, 0);
static auto XSDSchemas() -> QHash <unsigned, QString>;
protected: protected:
virtual unsigned MinVer() const override; virtual unsigned MinVer() const override;
virtual unsigned MaxVer() const override; virtual unsigned MaxVer() const override;
@ -48,12 +51,13 @@ protected:
virtual QString MinVerStr() const override; virtual QString MinVerStr() const override;
virtual QString MaxVerStr() const override; virtual QString MaxVerStr() const override;
virtual QString XSDSchema(unsigned ver) const override;
virtual void ApplyPatches() override; virtual void ApplyPatches() override;
virtual void DowngradeToCurrentMaxVersion() override; virtual void DowngradeToCurrentMaxVersion() override;
virtual bool IsReadOnly() const override {return false;} virtual bool IsReadOnly() const override {return false;}
auto Schemas() const -> QHash <unsigned, QString> override;
private: private:
Q_DISABLE_COPY_MOVE(VWatermarkConverter) // NOLINT Q_DISABLE_COPY_MOVE(VWatermarkConverter) // NOLINT
static const QString WatermarkMinVerStr; static const QString WatermarkMinVerStr;

View File

@ -16,6 +16,11 @@ VTestApp {
condition: Utilities.versionCompare(Qt.core.version, "6") >= 0 condition: Utilities.versionCompare(Qt.core.version, "6") >= 0
} }
Depends {
name: "Qt.xmlpatterns"
condition: Utilities.versionCompare(Qt.core.version, "6") < 0
}
name: "ValentinaTest" name: "ValentinaTest"
buildconfig.appTarget: qbs.targetOS.contains("macos") ? "ValentinaTest" : "valentinaTest" buildconfig.appTarget: qbs.targetOS.contains("macos") ? "ValentinaTest" : "valentinaTest"
targetName: buildconfig.appTarget targetName: buildconfig.appTarget
@ -70,6 +75,8 @@ VTestApp {
"tst_vtranslatevars.h", "tst_vtranslatevars.h",
"tst_vabstractpiece.h", "tst_vabstractpiece.h",
"tst_vtooluniondetails.h", "tst_vtooluniondetails.h",
"tst_xsdschema.cpp",
"tst_xsdschema.h",
] ]
Group { Group {

View File

@ -28,6 +28,10 @@
#include <QtTest> #include <QtTest>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <xercesc/util/PlatformUtils.hpp>
#endif
#include "tst_vposter.h" #include "tst_vposter.h"
#include "tst_vabstractpiece.h" #include "tst_vabstractpiece.h"
#include "tst_vspline.h" #include "tst_vspline.h"
@ -52,6 +56,7 @@
#include "tst_vtooluniondetails.h" #include "tst_vtooluniondetails.h"
#include "tst_vdomdocument.h" #include "tst_vdomdocument.h"
#include "tst_dxf.h" #include "tst_dxf.h"
#include "tst_xsdschema.h"
#include "../vmisc/def.h" #include "../vmisc/def.h"
#include "../qmuparser/qmudef.h" #include "../qmuparser/qmudef.h"
@ -62,6 +67,12 @@ int main(int argc, char** argv)
{ {
Q_INIT_RESOURCE(schema); Q_INIT_RESOURCE(schema);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
XERCES_CPP_NAMESPACE::XMLPlatformUtils::Initialize();
auto Terminate = qScopeGuard([](){ XERCES_CPP_NAMESPACE::XMLPlatformUtils::Terminate(); });
#endif
TestVApplication app( argc, argv );// For QPrinter TestVApplication app( argc, argv );// For QPrinter
QResource::registerResource(QCoreApplication::applicationDirPath() + QStringLiteral("/test_data.rcc")); QResource::registerResource(QCoreApplication::applicationDirPath() + QStringLiteral("/test_data.rcc"));
@ -96,6 +107,7 @@ int main(int argc, char** argv)
ASSERT_TEST(new TST_VTranslateVars()); ASSERT_TEST(new TST_VTranslateVars());
ASSERT_TEST(new TST_VToolUnionDetails()); ASSERT_TEST(new TST_VToolUnionDetails());
ASSERT_TEST(new TST_DXF()); ASSERT_TEST(new TST_DXF());
ASSERT_TEST(new TST_XSDShema());
return status; return status;
} }

View File

@ -0,0 +1,269 @@
/************************************************************************
**
** @file tst_xsdschema.cpp
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 10 2, 2023
**
** @brief
** @copyright
** This source code is part of the Valentina project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2023 Valentina project
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#include "tst_xsdschema.h"
#include "../ifc/xml/vpatternconverter.h"
#include "../ifc/xml/vlabeltemplateconverter.h"
#include "../ifc/xml/vlayoutconverter.h"
#include "../ifc/xml/vvitconverter.h"
#include "../ifc/xml/vvstconverter.h"
#include "../ifc/xml/vwatermarkconverter.h"
#include "../ifc/xml/vparsererrorhandler.h"
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <xercesc/parsers/XercesDOMParser.hpp>
#include <QMap>
#else
#include <QXmlSchema>
#include <QXmlSchemaValidator>
#endif // QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
namespace
{
//---------------------------------------------------------------------------------------------------------------------
void ValidateSchema(const QString &schema)
{
QFile fileSchema(schema);
if (not fileSchema.open(QIODevice::ReadOnly))
{
QFAIL(qUtf8Printable(QStringLiteral("Can't open file %1:\n%2.").arg(schema, fileSchema.errorString())));
}
VParserErrorHandler parserErrorHandler;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QScopedPointer<QTemporaryFile> tempSchema(QTemporaryFile::createNativeFile(fileSchema));
if (tempSchema == nullptr)
{
QFAIL(qUtf8Printable(QStringLiteral("Can't create native file for schema file %1:\n%2.")
.arg(schema, fileSchema.errorString())));
}
if (tempSchema->open())
{
XercesDOMParser domParser;
domParser.setErrorHandler(&parserErrorHandler);
if (domParser.loadGrammar(
tempSchema->fileName().toUtf8().constData(), Grammar::SchemaGrammarType, true) == nullptr)
{
QFAIL(qUtf8Printable(QStringLiteral("%1 Could not load schema file '%2'.")
.arg(parserErrorHandler.StatusMessage(), fileSchema.fileName())));
}
QVERIFY2(not parserErrorHandler.HasError(),
qUtf8Printable(QStringLiteral("%1 Schema file %2 invalid in line %3 column %4.")
.arg(parserErrorHandler.StatusMessage(), fileSchema.fileName())
.arg(parserErrorHandler.Line())
.arg(parserErrorHandler.Column())));
}
else
{
QFAIL("Unable to open native file for schema");
}
#else
QXmlSchema sch;
sch.setMessageHandler(&parserErrorHandler);
if (not sch.load(&fileSchema, QUrl::fromLocalFile(fileSchema.fileName())))
{
QFAIL(qUtf8Printable(QStringLiteral("%1 Could not load schema file '%2'.")
.arg(parserErrorHandler.StatusMessage(), fileSchema.fileName())));
}
QVERIFY2(sch.isValid(), qUtf8Printable(QStringLiteral("%1 Validation error file %2 in line %3 column %4.")
.arg(parserErrorHandler.StatusMessage(), fileSchema.fileName())
.arg(parserErrorHandler.Line())
.arg(parserErrorHandler.Column())));
#endif
}
//---------------------------------------------------------------------------------------------------------------------
auto HashToMap(const QHash<unsigned int, QString> &hash) -> QMap<unsigned int, QString>
{
QMap<unsigned int, QString> map;
auto i = hash.constBegin();
while (i != hash.constEnd())
{
map.insert(i.key(), i.value());
++i;
}
return map;
}
} // namespace
//---------------------------------------------------------------------------------------------------------------------
TST_XSDShema::TST_XSDShema(QObject *parent)
:QObject(parent)
{}
//---------------------------------------------------------------------------------------------------------------------
void TST_XSDShema::TestPatternSchema_data()
{
QTest::addColumn<QString>("schema");
const QMap<unsigned int, QString> schemas = HashToMap(VPatternConverter::XSDSchemas());
auto i = schemas.constBegin();
while (i != schemas.constEnd())
{
QFileInfo f(i.value());
QTest::newRow(qUtf8Printable(f.fileName())) << i.value();
++i;
}
}
//---------------------------------------------------------------------------------------------------------------------
void TST_XSDShema::TestPatternSchema()
{
QFETCH(QString, schema);
ValidateSchema(schema);
}
//---------------------------------------------------------------------------------------------------------------------
void TST_XSDShema::TestPatternLabelSchema_data()
{
QTest::addColumn<QString>("schema");
const QMap<unsigned int, QString> schemas = HashToMap(VLabelTemplateConverter::XSDSchemas());
auto i = schemas.constBegin();
while (i != schemas.constEnd())
{
QFileInfo f(i.value());
QTest::newRow(qUtf8Printable(f.fileName())) << i.value();
++i;
}
}
//---------------------------------------------------------------------------------------------------------------------
void TST_XSDShema::TestPatternLabelSchema()
{
QFETCH(QString, schema);
ValidateSchema(schema);
}
//---------------------------------------------------------------------------------------------------------------------
void TST_XSDShema::TestLayoutSchema_data()
{
QTest::addColumn<QString>("schema");
const QMap<unsigned int, QString> schemas = HashToMap(VLayoutConverter::XSDSchemas());
auto i = schemas.constBegin();
while (i != schemas.constEnd())
{
QFileInfo f(i.value());
QTest::newRow(qUtf8Printable(f.fileName())) << i.value();
++i;
}
}
//---------------------------------------------------------------------------------------------------------------------
void TST_XSDShema::TestLayoutSchema()
{
QFETCH(QString, schema);
ValidateSchema(schema);
}
//---------------------------------------------------------------------------------------------------------------------
void TST_XSDShema::TestVITSchema_data()
{
QTest::addColumn<QString>("schema");
const QMap<unsigned int, QString> schemas = HashToMap(VVITConverter::XSDSchemas());
auto i = schemas.constBegin();
while (i != schemas.constEnd())
{
QFileInfo f(i.value());
QTest::newRow(qUtf8Printable(f.fileName())) << i.value();
++i;
}
}
//---------------------------------------------------------------------------------------------------------------------
void TST_XSDShema::TestVITSchema()
{
QFETCH(QString, schema);
ValidateSchema(schema);
}
//---------------------------------------------------------------------------------------------------------------------
void TST_XSDShema::TestVSTSchema_data()
{
QTest::addColumn<QString>("schema");
const QMap<unsigned int, QString> schemas = HashToMap(VVSTConverter::XSDSchemas());
auto i = schemas.constBegin();
while (i != schemas.constEnd())
{
QFileInfo f(i.value());
QTest::newRow(qUtf8Printable(f.fileName())) << i.value();
++i;
}
}
//---------------------------------------------------------------------------------------------------------------------
void TST_XSDShema::TestVSTSchema()
{
QFETCH(QString, schema);
ValidateSchema(schema);
}
//---------------------------------------------------------------------------------------------------------------------
void TST_XSDShema::TestWatermarkSchema_data()
{
QTest::addColumn<QString>("schema");
const QMap<unsigned int, QString> schemas = HashToMap(VWatermarkConverter::XSDSchemas());
auto i = schemas.constBegin();
while (i != schemas.constEnd())
{
QFileInfo f(i.value());
QTest::newRow(qUtf8Printable(f.fileName())) << i.value();
++i;
}
}
//---------------------------------------------------------------------------------------------------------------------
void TST_XSDShema::TestWatermarkSchema()
{
QFETCH(QString, schema);
ValidateSchema(schema);
}

View File

@ -0,0 +1,62 @@
/************************************************************************
**
** @file tst_xsdschema.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 10 2, 2023
**
** @brief
** @copyright
** This source code is part of the Valentina project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2023 Valentina project
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#ifndef TST_XSDSCHEMA_H
#define TST_XSDSCHEMA_H
#include <QObject>
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif
class TST_XSDShema :public QObject
{
Q_OBJECT // NOLINT
public:
explicit TST_XSDShema(QObject *parent = nullptr);
~TST_XSDShema() override = default;
private slots:
void TestPatternSchema_data();
void TestPatternSchema();
void TestPatternLabelSchema_data();
void TestPatternLabelSchema();
void TestLayoutSchema_data();
void TestLayoutSchema();
void TestVITSchema_data();
void TestVITSchema();
void TestVSTSchema_data();
void TestVSTSchema();
void TestWatermarkSchema_data();
void TestWatermarkSchema();
private:
Q_DISABLE_COPY_MOVE(TST_XSDShema) // NOLINT
};
#endif // TST_XSDSCHEMA_H