W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > January to March 2001

Templates in W3C XML Schemas

From: Xavier Girones <xavier_girones@hp.com>
Date: Fri, 30 Mar 2001 17:40:43 +0200
Message-ID: <009901c0b92f$c81eb130$1a06b40f@bpo.hp.com>
To: <www-xml-schema-comments@w3.org>
Hi guys,

    last week I read your XML Schema Primer document and started writing
some schemas for my new assignments.  
    I found W3C Schema specification very versatile and expressive, even
beyond strongly typed languages such as C++. Particularly, the uniqueness 
and referential integrity constraint features are really useful. 

    However, I think there is a feature mising, I'm talking about templates,
which I usually prefer to inheritance. I think it would be great that a declaration 
equivalent to the following one were supported by schemas

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema" elementFormDefault="qualified">
    <xsd:complexType name="Soup_Template_t">
            <xsd:templateParm name="ingredient_parm"></xsd:templateParm>
            <xsd:element name="Water" type="xsd:decimal"/>
            <xsd:element name="Salt" type="xsd:decimal"/>
            <xsd:element templateRef="ingredient_parm">
    <xsd:element name="Leeks" type="xsd:integer"/>
    <xsd:complexType name="LeekSoup_t">
            <xsd:extension base="Soup_Template_t">
                    <xsd:templateParm name="ingredient_parm" ref="Leeks"/>
    <xsd:element name="LeekSoup" type="LeekSoup_t"/>

 I know my example is incomplete and that the keywords I'm using are probably inconsistent,
but if you have done some C++ STL programming probably know I'm talking about:
I simply can't survive without templates!

  Thanks for your attention,
  Xavier Girones

Received on Friday, 30 March 2001 10:41:16 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:49:54 UTC