[main] Added import XML scheme for books

This commit is contained in:
Thastertyn 2025-01-10 14:50:19 +01:00
parent 48d1a28783
commit 50227b9a2b

View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="books">
<xs:complexType>
<xs:sequence>
<xs:element name="book" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="title"> <!-- Book title-->
<xs:simpleType>
<!-- Allow for a string 2-100 characters long -->
<xs:restriction base="xs:string">
<xs:minLength value="2" />
<xs:maxLength value="100" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="description" type="xs:string" /> <!-- Description -->
<xs:element name="year_published"> <!-- Year published -->
<xs:simpleType>
<xs:restriction base="xs:gYear" />
</xs:simpleType>
</xs:element>
<xs:element name="isbn"> <!-- ISBN -->
<xs:simpleType>
<!-- Strictly limit to either 10 or 13 digits -->
<xs:restriction base="xs:string">
<xs:pattern value="\d{10}" />
<xs:pattern value="\d{13}" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="categories"> <!-- Categories list -->
<xs:complexType>
<xs:sequence>
<xs:element name="category" type="xs:string" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>