Soit le schéma S1 ci-après.
1
2
<grammar xmlns="http://relaxng.org/ns/structure/1.0" ns="http://utc.fr/nf29/S1">
3
<start>
4
<element name="book">
5
<optional>
6
<element name="info">
7
<element name="title">
8
<text/>
9
</element>
10
<optional>
11
<element name="author">
12
<element name="email">
13
<text/>
14
</element>
15
</element>
16
</optional>
17
</element>
18
</optional>
19
<oneOrMore>
20
<element name="part">
21
<ref name="Title"/>
22
<choice>
23
<ref name="Text"/>
24
<oneOrMore>
25
<element name="chapter">
26
<ref name="Title"/>
27
<ref name="Text"/>
28
</element>
29
</oneOrMore>
30
</choice>
31
</element>
32
</oneOrMore>
33
</element>
34
</start>
35
<define name="Title">
36
<element name="title">
37
<text/>
38
</element>
39
<optional>
40
<element name="subtitle">
41
<text/>
42
</element>
43
</optional>
44
</define>
45
<define name="Text">
46
<oneOrMore>
47
<element name="para">
48
<text/>
49
</element>
50
</oneOrMore>
51
</define>
52
</grammar>
Question
Produisez le plus petit document XML valide possible.
Solution
1
2
<book xmlns="http://utc.fr/nf29/S1">
3
<part>
4
<title/>
5
<para/>
6
</part>
7
</book>
Question
Produisez le plus petit document XML valide contenant tous les éléments.
Solution
1
2
<book xmlns="http://utc.fr/nf29/S1">
3
<info>
4
<title/>
5
<author>
6
<email/>
7
</author>
8
</info>
9
<part>
10
<title/>
11
<subtitle/>
12
<chapter>
13
<title/>
14
<para/>
15
</chapter>
16
</part>
17
</book>