Templates in W3C XML Schemas

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:templateParmsDecl>
            <xsd:templateParm name="ingredient_parm"></xsd:templateParm>
        </xsd:templateParmsDecl>
        <xsd:sequence>
            <xsd:element name="Water" type="xsd:decimal"/>
            <xsd:element name="Salt" type="xsd:decimal"/>
            <xsd:element templateRef="ingredient_parm">
        </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="Leeks" type="xsd:integer"/>
    <xsd:complexType name="LeekSoup_t">
        <xsd:complexContent>
            <xsd:extension base="Soup_Template_t">
                <xsd:templateParms>
                    <xsd:templateParm name="ingredient_parm" ref="Leeks"/>
                </xsd:templateParms>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <xsd:element name="LeekSoup" type="LeekSoup_t"/>
</xsd:schema>


 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