W3C home > Mailing lists > Public > xmlschema-dev@w3.org > October 2004

restrict element content by the attribute from a different namespace?

From: <maksim@likharev.com>
Date: Wed, 27 Oct 2004 23:28:54 -0700
To: <xmlschema-dev@w3.org>
Message-ID: <E1CN3mL-0002h4-DQ@frink.w3.org>
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 06:30:35 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 07:15:11 UTC