Skip to content
7 changes: 7 additions & 0 deletions books.dtd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!ELEMENT bookstore (book*)>
<!ELEMENT book (title,author+,year,price)>
<!ATTLIST book category CDATA #REQUIRED>
<!ATTLIST book cover CDATA #IMPLIED>
<!ATTLIST book cover (hardback|paperback) "paperback">
<!ATTLIST title lang CDATA #REQUIRED>
<!ATTLIST title lang CDATA "en">
9 changes: 9 additions & 0 deletions books.xml
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
<!DOCTYPE bookstore [
<!ELEMENT bookstore (book*)>
<!ELEMENT book (title,author+,year,price)>
<!ATTLIST book category CDATA #REQUIRED>
<!ATTLIST book cover CDATA #IMPLIED>
<!ATTLIST book cover (hardback|paperback) "paperback">
<!ATTLIST title lang CDATA #REQUIRED>
<!ATTLIST title lang CDATA "en">
]>
<bookstore>
<book category="cooking">
<title lang="en">Everyday Italian</title>
Expand Down
63 changes: 63 additions & 0 deletions books.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<xs:schema xmlns:xs="hhtp://wwww.w3.org/2001/XMLSchema">
<xs:element name="bookstore" type="Bookstore"/>

<xs:complexType name="Bookstore">
<xs:sequence>
<xs:element name="book" type="Book"/>
</xs:sequence>
</xs:complexType>

<xs:complexType name="Book">
<xs:sequence>
<xs:element name="title">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLenght value="2"/>
<xs:maxLenght value="30">
</xs:restriction>
</xs:simpleType>
<xs:complexType>
<xs:attribute name ="lang" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:lenght value="2"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="author">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLenght value="2"/>
<xs:maxLenght value="30">
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="year">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="1900"/>
<xs:maxInclusive value="2014">
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="price">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:minIclusive value="0.0"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:attribute name="category" type="xs:string" use="required"/>
<xs:attribute name="cover" type="coverType" use="implied"/>
<xs:simpleType name="coverType">
<xs:restriction base="xs:string">
<xs:enumeration value="hardback"/>
<xs:enumeration value="paperback"/>
</xs:restriction>
</xs:simpleType>
</xs:sequence>
</xs:complexType>

</xs:schema>
5 changes: 5 additions & 0 deletions student.dtd
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
<!ELEMENT student EMPTY>
<!ATTLIST student
fullname CDATA #REQUIRED
group (К6-361|К6-362) #REQUIRED
>

3 changes: 3 additions & 0 deletions student.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0"?>
<!DOCTYPE student SYSTEM "student.dtd">
<student fullname="Пурик Яна" group="K6-362"></student>
1 change: 1 addition & 0 deletions task16.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
+//book
1 change: 1 addition & 0 deletions task17.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
+//book[@cover]
1 change: 1 addition & 0 deletions task18.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
+//book[@year=2003]
1 change: 1 addition & 0 deletions task19.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
+//book[@price>=30 and @price<40]