Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


problem with title hierarchy in schema

From: Andreas Peter <info@-------.-->
To: XML Schema List <xmlschema-dev@--.--->
Date: 2/3/2008 1:22:00 PM
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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent