Re: variable element names

Yes.  Define the "variable" element as:

<xsd:any processContents="strict"/>

What you can't do is control the order or appearance of the children. What 
the above does do is make sure you have a global <xsd:element> declaration 
for each child, and that the contents of each child are correct.

So:

 
        <parent>
                <var>
                        <x>123</x>
                        <w><a/></w>
                        <z/>
                </var>
        <parent>

So, parent would have the <xsd:any as its content, and that would accept 
the <var>.  You can't control the order in which children of <var> appear 
(<w>. appears after <x>, and <y> is missing), but there MUST be a 
declaration for each of <w>, <x>, and <z>, and those elements must 
validate per the declarations.

If you use "lax" instead of "strict", then it's optional to provide the 
declarations for elements like <w>;  any one that doesn't have a 
declaration will be accepted, no matter what its contents.

------------------------------------------------------------------
Noah Mendelsohn                              Voice: 1-617-693-4036
IBM Corporation                                Fax: 1-617-693-8676
One Rogers Street
Cambridge, MA 02142
------------------------------------------------------------------







Mike Rothe <Mike_Rothe@actiontech.com>
Sent by: xmlschema-dev-request@w3.org
11/18/2002 08:36 PM

 
        To:     "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
        cc:     (bcc: Noah Mendelsohn/Cambridge/IBM)
        Subject:        variable element names



There is an element in my schema that is a variable element, meaning that 
on
the instance doc that element name could be anything. However, all the 
child
elements contained in the variable element have fixed names. I would like 
to
validate the children of the element with the variable name. Does the
standard support this?

Received on Monday, 18 November 2002 21:10:07 UTC