- From: Morris Matsa <mmatsa@us.ibm.com>
- Date: Fri, 25 Jul 2003 10:37:51 -0400
- To: Daniel Patel <danielp@ii.uib.no>
- Cc: xmlschema-dev@w3.org
I believe that the answer to both of your questions is the same. The current spec does not allow any of these co-occurance constraints. The working group has said that handling co-occurance constraints is on their list of candidate requirements for version 1.1. You can check out various replies to this old post about another co-occurance question, including hybrid options. [1] Your best option within the Schema language might be using xsi:type [2] to specify the type of the element and having one type, e.g., prohibit all attributes. For more details on that, see [3]. Then your second example might look like: <arg xsi:type="type1" att="aaa"> <name>daniel<name> </arg> <arg xsi:type="type2" differentAtt="bbb"> <age>26</age> </arg> . [1] http://lists.w3.org/Archives/Public/xmlschema-dev/2002Jan/0189.html [2] http://www.w3.org/TR/xmlschema-0/#UseDerivInInstDocs [3] http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#xsi_type Daniel Patel <danielp@ii.uib.no>@w3.org on 07/23/2003 09:57:55 AM Sent by: xmlschema-dev-request@w3.org To: xmlschema-dev@w3.org cc: Subject: element with multiple definitions 2 questions : 1. Is it possible to specify that for an element, either all or none of its attributes must be specified. Specifying only some of them is not allowed. 2. How can i specify in an xml schema so an element with name 'arg' either consists of an attribute att and contains a simple element name, ex: <arg att="aaa"> <name>daniel<name> </arg> or consists of an attribute differentAtt and a simple element age: <arg differentAtt="bbb"> <age>26</age> </arg> . I don't want having an arg element with both attributes or both name and age element to be legal. Daniel
Received on Friday, 25 July 2003 10:39:57 UTC