problem with title hierarchy in schema

Hello List,

I am relatively new to XMLSchema. I am going to write a custom schema 
for Word 2003/2007.
Currently I am working at the title hierarchy. My aim is to have a 
schema which shows when a structural problem inside the document occurs.

This is what I want to realise:

Element titles can contain different subtitles such as ebene1 | ebene2 | 
ebene3 | ebene4

if ebene1 occurs there should only be ebene2 | para

if ebene2 occurs there should only be ebene1 | ebene3 | para

if ebene3 occurs there should only be ebene1 | ebene2 | ebene4 | para

and if ebene4 occurs there should be only ebene1 | ebene2 | ebene3 | para

There should be an element chapter which contains all the posibilities 
mentioned above.

This is what I have done so far:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:include schemaLocation="aud_para.xsd"/>

    <xs:element name="ebene1" type="xs:string"/>
    <xs:element name="ebene2" type="xs:string"/>
    <xs:element name="ebene3" type="xs:string"/>
    <xs:element name="ebene4" type="xs:string"/>

    <xs:group name="section1">
        <xs:choice>
            <xs:element ref="ebene1"/>
            <xs:element name="para" type="paraType"/>
        </xs:choice>
    </xs:group>

    <xs:group name="section2">
        <xs:choice>
            <xs:element ref="ebene1"/>
            <xs:element ref="ebene3"/>
            <xs:element name="para" type="paraType"/>
        </xs:choice>
    </xs:group>

    <xs:group name="section3">
        <xs:choice>
            <xs:element ref="ebene1"/>
            <xs:element ref="ebene2"/>
            <xs:element ref="ebene4"/>
            <xs:element name="para" type="paraType"/>
        </xs:choice>
    </xs:group>

    <xs:group name="section4">
        <xs:choice>
            <xs:element ref="ebene1"/>
            <xs:element ref="ebene2"/>
            <xs:element ref="ebene3"/>
            <xs:element name="para" type="paraType"/>
        </xs:choice>
    </xs:group>

    <xs:complexType name="chapterType" mixed="true">
        <xs:choice>
            <xs:group ref="section1"/>
            <xs:group ref="section2"/>
            <xs:group ref="section3"/>
            <xs:group ref="section4"/>
        </xs:choice>
    </xs:complexType>
</xs:schema>

My question: is this the right approach or are there more useful 
approaches? I am new to schema :-(

Thanks for helping me,
Andreas

Received on Sunday, 3 February 2008 11:22:22 UTC