Contenu mixte

Syntaxe

1
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
2
    <start>
3
        <element name="mixedElement">
4
            <zeroOrMore>
5
                <choice>
6
                    <text/>
7
                    <element name="inlineElement">...</element> 
8
                    ... 
9
                </choice>
10
            </zeroOrMore>
11
        </element>
12
    </start>
13
</grammar>

Exemple

1
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
2
    <start>
3
        <element name="paragraph">
4
            <zeroOrMore>
5
                <choice>
6
                    <text/>
7
                    <element name="emphasis"><text/></element>
8
                    <element name="foreign"><text/></element>
9
                </choice>
10
            </zeroOrMore>
11
        </element>
12
    </start>
13
</grammar>

SyntaxeMixed content avec interleave

1
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
2
    <start>
3
        <element name="mixedElement">
4
            <interleave>
5
                <text/>
6
                <zeroOrMore>
7
                    <element name="inlineElement">...</element>
8
                </zeroOrMore>
9
                <zeroOrMore> 
10
                    ... 
11
                </zeroOrMore> 
12
                ... 
13
            </interleave>
14
        </element>
15
    </start>
16
</grammar>

ExempleMixed content avec interleave

1
<?xml version="1.0" encoding="UTF-8"?>
2
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
3
    <start>
4
        <element name="paragraph">
5
            <interleave>
6
                <text/>
7
                <zeroOrMore>
8
                    <element name="emphasis">
9
                        <text/>
10
                    </element>
11
                </zeroOrMore>
12
                <zeroOrMore>
13
                    <element name="foreign">
14
                        <text/>
15
                    </element>
16
                </zeroOrMore>
17
            </interleave>
18
        </element>
19
    </start>
20
</grammar>