RE: restrict element content by the attribute from a different namespace?

Michael,

I thought about that, but thing getting knotty when number of attributes
grows ( like adding new one base:searchable )

Another options would be creating several groups and reference them, not
like impractical but I rather wanted to understand any other options.
Initially I thought that some kind of key/keyref could do the trick, where
key defined for the schema itself and keyref for the target document.

 

Thank you.

Maksim

 

  _____  

From: Michael Kay [mailto:mike@saxonica.com] 
Sent: Thursday, October 28, 2004 12:26 AM
To: maksim@likharev.com; xmlschema-dev@w3.org
Subject: RE: restrict element content by the attribute from a different
namespace?

 

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 17:58:00 UTC