- From: Michael Kay <mike@saxonica.com>
- Date: Thu, 28 Oct 2004 08:25:54 +0100
- To: <maksim@likharev.com>, <xmlschema-dev@w3.org>
- Message-Id: <E1CN4fV-0001vZ-00@ukmail1.eechost.net>
Why not put all the fields with base:readonly="0" into one substitution
group, and those with base:readonly="1" into another?
Michael Kay
_____
From: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org] On
Behalf Of maksim@likharev.com
Sent: 28 October 2004 07:29
To: xmlschema-dev@w3.org
Subject: restrict element content by the attribute from a different
namespace?
Perhaps I'm looking into a wrong direction and this is totally wrong,
but I would like restrict element content by the attribute from a different
namespace.
Suppose I have a schema "base.xsd" where declared a set of attributes, for
say:
<!-- base.xsd -->
<xs:attribute name="readonly" type="xs:boolean" />
...
this is used for service information.
In the schema "main.xsd" I have set of elements:
<!-- main.xsd -->
<xs:element name="generic" type="xs:anyType" abstract="1" />
<xs:element name="field1" type="xs:string" substitutionGroup="generic"
base:readonly="0" />
<xs:element name="field2" type="xs:string" substitutionGroup="generic"
base:readonly="1" />
...
<xs:element name="fields">
<xs:complexType>
<xs:sequence>
<xs:element ref="generic" minOccurs="1"
maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
As you can see abstract types and elements in play, that's solely for
versioning, all those C#/java tends to
tolerate following construct more loose and adding new field generally
doesn't break the code.
What I would like to do, is restrict set of elements in the <fields> to only
where base:readonly="1"
Received on Thursday, 28 October 2004 07:25:59 UTC