W3C home > Mailing lists > Public > xmlschema-dev@w3.org > November 2008

Derivation of complex types using a global and local schema file

From: Nils Kaiser <NilsKaiser@gmx.net>
Date: Wed, 19 Nov 2008 10:52:06 +0100
Message-ID: <4923E1C6.3050905@gmx.net>
To: xmlschema-dev@w3.org
Hi all,

I'm quite new to xml schema, especially to the area of overriding 
existing types (derivation, restriction, etc.). I have the following use 
case and I'd appreciate some input on the best way to model it in xml 
schema.

I have a template format in xml which is used to declare content using 
templates, lets say:

<page>
  <section template="intro">
     <input type="text" name="title">Welcome</input>
     <input type="longtext" name="body">Hello, welcome to the main 
page</input>
  </section>
  <section template="withpic">
     <input type="link name="picurl">http://.......</input>
     <input type="longtext" name="body">This is a wonderful picture</input>
  </section>
  <section template="withpic">
     <input type="link" name="picurl">http://.......</input>
     <input type="longtext" name="body">This is another picture</input>
     <input type="checkbox" name="position">left</input> <!-- optional, 
only values allowed left, right, center -->
  </section>
</page>

Now, there are two levels of declaration:
1) the basic elements page, section, input types  (link, longtext, 
checkbox...)
2) the sections depending on the value of the template attribute 
(withpic, intro), that restrict which input types can be used within 
this section.

I'd like to split both levels in different schema files, a global schema 
and a special schema, using the overriding mechanisms of xml schema 
(derivation, restriction, redefinition...). What is the best way to 
implement the overriding of the global schema by the local one?

Especially because the derivation depends on the attribute value 
(template=??) I am not sure how to implement this.

Thx for any hints or suggestions!

Nils
Received on Wednesday, 19 November 2008 12:12:39 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:15:09 GMT