W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > July to September 2000

How to define "generic" elements

From: Nick K. Aghazarian <Ace@AceProgrammer.com>
Date: Thu, 27 Jul 2000 16:19:15 -0700
Message-ID: <3980C373.5050505@AceProgrammer.com>
To: www-xml-schema-comments@w3.org
  I have a instance document with the following fragment:


In this example, the "QueryName" element is used to specify an entity 
defined to our server that has a SQL String with named replacement 
paramenters.  The names of the parameters in this example are "State" 
and "Status".  For another query the parameters might be "CustomerName" 
or "ProductName".
The "Query", "QueryName" and "Parameters" elements are all known, and 
are easily defined in the Schema.
I am not sure how to define the rest correctly.  Here's my guess (please 
ignore the namespace issues).

<complexType name="QueryRequest">
  <element name="QueryName" type="string" content="textOnly" 
minOccurs="1" />
  <element name="Parameters" type="QueryParameters" minOccurs="0" 
maxOccurs="1" />

<complexType name="QueryParameters" content="eltOnly">
  <element type="string" content="textOnly" minOccurs="1" 
maxOccurs="unbounded" />

I've got a number of places where I need a generic element where I know 
what the behaviour of the elements will be, but I'd like (for the sake 
of readability) to use the name of the element to reflect specific data 
items on the server.
In other words, I know I could reference the parameters like:


but the people defining these docs like the first way better (and so do 
I), so I'd like to find a way to make it work.

Any pointers you can give would be greatly appreciated.  Also, if this 
is possible, if you could give an example of something like it in the 
Primer that would be cool.


Nick K. Aghazarian
Received on Thursday, 27 July 2000 19:21:54 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:49:53 UTC