68 lines
3.5 KiB
XML
68 lines
3.5 KiB
XML
|
<?xml version="1.0" encoding="UTF-8"?>
|
||
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||
|
|
||
|
<!-- Определение элемента "library", который содержит один или более элементов "book" -->
|
||
|
<xs:element name="library">
|
||
|
<xs:complexType>
|
||
|
<xs:sequence>
|
||
|
<xs:element name="book" maxOccurs="unbounded" minOccurs="1">
|
||
|
<xs:complexType>
|
||
|
<xs:sequence>
|
||
|
<xs:element name="title">
|
||
|
<xs:simpleType>
|
||
|
<xs:restriction base="xs:string">
|
||
|
<xs:minLength value="5"/>
|
||
|
</xs:restriction>
|
||
|
</xs:simpleType>
|
||
|
</xs:element>
|
||
|
|
||
|
<xs:element name="author">
|
||
|
<xs:simpleType>
|
||
|
<xs:restriction base="xs:string">
|
||
|
<xs:minLength value="5"/>
|
||
|
</xs:restriction>
|
||
|
</xs:simpleType>
|
||
|
</xs:element>
|
||
|
|
||
|
<xs:element name="genre">
|
||
|
<xs:simpleType>
|
||
|
<xs:restriction base="xs:string">
|
||
|
<xs:enumeration value="Fiction"/>
|
||
|
<xs:enumeration value="Non-Fiction"/>
|
||
|
<xs:enumeration value="Fantasy"/>
|
||
|
<xs:enumeration value="Mystery"/>
|
||
|
<xs:enumeration value="History"/>
|
||
|
</xs:restriction>
|
||
|
</xs:simpleType>
|
||
|
</xs:element>
|
||
|
|
||
|
<!-- Описание для year -->
|
||
|
<xs:element name="year" type="xs:gYear"/>
|
||
|
<xs:element name="era">
|
||
|
<xs:simpleType>
|
||
|
<xs:restriction base="xs:string">
|
||
|
<xs:enumeration value="BC"/> <!-- До нашей эры -->
|
||
|
<xs:enumeration value="AD"/> <!-- Наша эра -->
|
||
|
</xs:restriction>
|
||
|
</xs:simpleType>
|
||
|
</xs:element>
|
||
|
|
||
|
</xs:sequence>
|
||
|
<xs:attribute name="ISBN">
|
||
|
<xs:simpleType>
|
||
|
<xs:restriction base="xs:string">
|
||
|
<xs:pattern value="(\d{10}|\d{13})"/> <!-- Шаблон для ISBN-10 или ISBN-13 -->
|
||
|
</xs:restriction>
|
||
|
</xs:simpleType>
|
||
|
</xs:attribute>
|
||
|
|
||
|
<xs:attribute name="available" type="xs:boolean" use="required" />
|
||
|
<xs:attribute name="publisher" type="xs:string" use="optional" />
|
||
|
<xs:attribute name="language" type="xs:string" use="optional" />
|
||
|
</xs:complexType>
|
||
|
</xs:element>
|
||
|
</xs:sequence>
|
||
|
</xs:complexType>
|
||
|
</xs:element>
|
||
|
|
||
|
</xs:schema>
|