aboutsummaryrefslogtreecommitdiffstats
path: root/examples/xmlpatterns/schema/files/recipe.xsd
blob: bbbafd9a31a751a256f3545a274075c7d0ce38e5 (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
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

    <xsd:element name="recipe">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="title" type="xsd:string"/>
                <xsd:element name="ingredient" type="ingredientType" maxOccurs="unbounded"/>
                <xsd:element name="time" type="timeType"/>
                <xsd:element name="method">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="step" type="xsd:string" maxOccurs="unbounded"/>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>

    <xsd:complexType name="ingredientType">
        <xsd:attribute name="name" type="xsd:string"/>
        <xsd:attribute name="quantity" type="xsd:positiveInteger"/>
        <xsd:attribute name="unit" type="xsd:string"/>
    </xsd:complexType>

    <xsd:complexType name="timeType">
        <xsd:attribute name="quantity" type="xsd:positiveInteger"/>
        <xsd:attribute name="unit">
            <xsd:simpleType>
                <xsd:restriction base="xsd:string">
                    <xsd:enumeration value="seconds"/>
                    <xsd:enumeration value="minutes"/>
                    <xsd:enumeration value="hours"/>
                </xsd:restriction>
            </xsd:simpleType>
        </xsd:attribute>
    </xsd:complexType>

</xsd:schema>