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

Re: variable element names

From: Morris Matsa <mmatsa@us.ibm.com>
Date: Tue, 19 Nov 2002 10:45:07 -0500
To: "Noah Mendelsohn" <noah_mendelsohn@us.ibm.com>
Cc: Mike Rothe <Mike_Rothe@actiontech.com>, "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
Message-ID: <OFBBE99EBB.7E966158-ON85256C76.00552F17@pok.ibm.com>



Additionally, if you're willing to change your instance, you can add an
xsi:type attribute ([1], [2]) to the variable-named element.  To use the
same example:

        <parent>
                <var xsi:type="varType">
                        <x>123</x>
                        <w><a/></w>
                        <z/>
                </var>
        <parent>


Now, you'd define varType as a complexType in the schema, and even the
order and contents could be enforced (w, x, y, z).  The schema would still
not enforce that the wildcard specify the xsi:type, and the clear tradeoff
is that your instances would need to specify it in order to get the added
checking.

[1] In the primer, http://www.w3.org/TR/xmlschema-0/#UseDerivInInstDocs
[2] Normative http://www.w3.org/TR/xmlschema-1/#xsi_type
Received on Tuesday, 19 November 2002 10:54:05 GMT

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