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

Re: pair interactions in XML schema

From: Jos van den Oever <oever@fenk.wau.nl>
Date: Mon, 17 Jun 2002 05:57:11 -0400 (EDT)
To: Jeni Tennison <jeni@jenitennison.com>, xmlschema-dev@w3.org
Cc: "Bob Schloss" <rschloss@us.ibm.com>
Message-Id: <200206171156.55924.oever@fenk.wau.nl>




Hello Bob and Jeni,

Thanks a lot for you efforts. Very clear explanations.
Maybe using Schematron in combination with Schema is the solution. However if 
possible I'd like to stick with Schema only. Schema would be very convenient 
for writing automatically valid input files for a program. I guess adding 
Schematron wouldn't be too bad if I could find an editor for writing XML 
files that conform to Schema and Schematron. Right now I haven't even found 
one that runs on linux for Schema alone yet. But that's just a matter of time 
I guess.

Below is a partial attempt at writing a schema for my needs.

On Monday 17 June 2002 11:22, Jeni Tennison wrote:
> I don't think that it's possible to express this in XML Schema,
> because of the rule that the fields of identity constraints must only
> select one information item.

So you can't share keys between objects, for example require that all 
<coutryside> and <city> objects have unique geographical locations?
That would foil another cunning plan I had that used the schema below to 
define persons.

 <xs:element name='person1'>
  <xs:complexType>
   <xs:sequence>
    <xs:element ref='person2' minOccurs='0' maxOccurs='1'/>
   </xs:sequence>
   <xs:attribute name='name' type='xs:NCName'/>
  </xs:complexType>
 </xs:element>

 <xs:element name='person2'>
  <xs:complexType>
   <xs:sequence>
    <xs:element ref='person3' minOccurs='0' maxOccurs='1'/>
   </xs:sequence>
   <xs:attribute name='acquaintance-person1' type='xs:nonNegativeInteger'
default='0'/>
   <xs:attribute name='name' type='xs:NCName'/>
  </xs:complexType>
 </xs:element>

 <xs:element name='person3'>
  <xs:complexType>
   <xs:attribute name='acquaintance-person1' type='xs:nonNegativeInteger'
default='0'/>
   <xs:attribute name='acquaintance-person2' type='xs:nonNegativeInteger'
default='0'/>
   <xs:attribute name='name' type='xs:NCName'/>
  </xs:complexType>
 </xs:element>

This will of course only work for a limited number of people. Is it possible 
to refer to all persons with a single key?

Best regards, Jos
Received on Monday, 17 June 2002 06:26:55 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:31 GMT