W3C home > Mailing lists > Public > xmlschema-dev@w3.org > June 2009

How to choice the attribute group for element?

From: bacoo <bacoo_zh@163.com>
Date: Sun, 7 Jun 2009 10:27:14 +0800
To: "xmlschema-dev" <xmlschema-dev@w3.org>
Message-ID: <200906071027138437245@163.com>
This is my first time to have a discussion here. I'm new to XML Schema.
Now I want to define an element with three attributes: A, B and C. However, I don't want the three attributes occur simultaneously.
I need A and B occur simultaneously, or only C occurs singlely.

<x A="a" B="b"/>
<x C="c">
How to do this?
I use 'choic' to implement this as follows, but it don't work.
<xs:choice maxOccurs="unbounded">
      <xs:element name="x"  type="xs:string">
<xs:attribute name="A" type="xs:string"/>
<xs:attribute name="B" type="xs:string"/>
      <xs:element name="x"  type="xs:string">
<xs:attribute name="C" type="xs:string"/>
By the way, after goooooogling, I found that the code above is right in the old XML Schema criteria, but nowadays I can't use it any more and the XMLSpy software will report errors with the code above. Is there anyone that know about the related information?
It has bothered me several days. I'll appreciate your help sincerely.
Received on Tuesday, 9 June 2009 07:32:57 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:51 UTC