summaryrefslogtreecommitdiff
path: root/xsd/examples/cxx/parser/library/library.xsd
blob: 57654c7925283a0375266ac824907d499e2657e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?xml version="1.0"?>

<!--

file      : examples/cxx/parser/library/library.xsd
author    : Boris Kolpackov <boris@codesynthesis.com>
copyright : not copyrighted - public domain

-->

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:lib="http://www.codesynthesis.com/library"
            targetNamespace="http://www.codesynthesis.com/library">

  <xsd:simpleType name="isbn">
    <xsd:restriction base="xsd:unsignedInt"/>
  </xsd:simpleType>


  <xsd:complexType name="title">
    <xsd:simpleContent>
      <xsd:extension base="xsd:string">
        <xsd:attribute name="lang" type="xsd:string"/>
      </xsd:extension>
    </xsd:simpleContent>
  </xsd:complexType>


  <xsd:simpleType name="genre">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="romance"/>
      <xsd:enumeration value="fiction"/>
      <xsd:enumeration value="horror"/>
      <xsd:enumeration value="history"/>
      <xsd:enumeration value="philosophy"/>
    </xsd:restriction>
  </xsd:simpleType>


  <xsd:complexType name="person">
    <xsd:sequence>
      <xsd:element name="name" type="xsd:string"/>
      <xsd:element name="born" type="xsd:string"/>
      <xsd:element name="died" type="xsd:string" minOccurs="0"/>
    </xsd:sequence>
  </xsd:complexType>


  <xsd:complexType name="author">
    <xsd:complexContent>
      <xsd:extension base="lib:person">
	<xsd:attribute name="recommends" type="xsd:IDREF"/> <!-- Book -->
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>


  <xsd:complexType name="book">
    <xsd:sequence>
      <xsd:element name="isbn" type="lib:isbn"/>
      <xsd:element name="title" type="lib:title"/>
      <xsd:element name="genre" type="lib:genre"/>
      <xsd:element name="author" type="lib:author" maxOccurs="unbounded"/>
    </xsd:sequence>
    <xsd:attribute name="available" type="xsd:boolean" use="required"/>
    <xsd:attribute name="id" type="xsd:ID" use="required"/>
  </xsd:complexType>


  <xsd:complexType name="catalog">
    <xsd:sequence>
      <xsd:element name="book" type="lib:book" maxOccurs="unbounded"/>
    </xsd:sequence>
  </xsd:complexType>


  <xsd:element name="catalog" type="lib:catalog"/>

</xsd:schema>