Re: variable element names

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 UTC