W3C home > Mailing lists > Public > xmlschema-dev@w3.org > August 2001

XML schema limitation?

From: Stephane Pageau <spageau@sed.ara.com>
Date: Mon, 16 Jul 2001 14:53:04 -0400 (EDT)
To: <xmlschema-dev@w3.org>
Cc: <jpowell@sed.ara.com>, <spageau@sed.ara.com>
Message-ID: <OOEMJADCNHMMKKLODJEOMEKJCGAA.spageau@sed.ara.com>
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 id=20 > 
   <x> 10. </x>
   <y> 45. </y>
<vertex id=30 > 
   <x> 10. </x>
   <y> 50. </y>
<shape id=1>
   <vertexptr> 10 </vertexptr>
   <vertexptr> 30 </vertexptr>
   <vertexptr> 20 </vertexptr>
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"/>
   <element name="x" type="decimal" minOccurs="1"/>
   <element name="y" type="decimal" minOccurs="1"/>
  <attribute name="id" type="ID"/>
<complexType name="shape"/>
   <element ref="vertex" minOccurs="1" maxOccurs="unbounded"/>
   <attribute name="id" type="ID"/>

Stephane Pageau
811 Spring Forest Rd, Suite 100
Raleigh, NC 27609
fax: (919) 878-3672 
Received on Wednesday, 22 August 2001 05:41:43 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:52 UTC