W3C home > Mailing lists > Public > xmlschema-dev@w3.org > July 2003

Re: element with multiple definitions

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
Message-ID: <OF49130877.3AF7867C-ON85256D6E.004F0726@us.ibm.com>

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">

  <arg xsi:type="type2" differentAtt="bbb">

[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
Subject:    element with multiple definitions

  2 questions :
  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.

  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,

  <arg att="aaa">

  consists of an attribute differentAtt and a simple element

  <arg differentAtt="bbb">

  I don't want having an arg element with both attributes or both
  name and age element to be legal.

Received on Friday, 25 July 2003 10:39:57 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:02 UTC