XML schema limitation?

How can I construct a XML schema in which 
I wish to enforce that the content 
of an element (e.g., a subelement) 
be an existing element of the instance
XML file?
To clarify this question let me take an example:
------------------------------------------------
Assume that I have a shape described using a 
bunch of vertices and I describe both the
vertices and the shape separately as follows: 
<vertex id=10 > 
   <x> 10. </x>
   <y> 60. </y>
</vertex>
<vertex id=20 > 
   <x> 10. </x>
   <y> 45. </y>
</vertex>
<vertex id=30 > 
   <x> 10. </x>
   <y> 50. </y>
</vertex>
...
<shape id=1>
   <vertexptr> 10 </vertexptr>
   <vertexptr> 30 </vertexptr>
   <vertexptr> 20 </vertexptr>
</shape>
How can I construct my schema to make sure that someone does not
put <vertexptr> 1000 </vertexptr> if
the vertex with id=1000 does not exist?

Note that I do not want to use the XML ref because there
might be several shapes refering to the same vertex
and I do not wish to repeat the coordinates of this vertex
multiple times. That is, I do not want to do the following:
<complexType name="vertex"/>
  <all>
   <element name="x" type="decimal" minOccurs="1"/>
   <element name="y" type="decimal" minOccurs="1"/>
  </all>
  <attribute name="id" type="ID"/>
</complexType>
<complexType name="shape"/>
   <element ref="vertex" minOccurs="1" maxOccurs="unbounded"/>
   <attribute name="id" type="ID"/>
</complexType>


Stephane Pageau
811 Spring Forest Rd, Suite 100
Raleigh, NC 27609
mailto:spageau@sed.ara.com
(919)876-0018
fax: (919) 878-3672 

Received on Wednesday, 22 August 2001 05:41:43 UTC