How to define "generic" elements

  I have a instance document with the following fragment:

<Query>
  <QueryName>CustomersInState</QueryName>
   <Parameters>
      <State>CA</State>
     <Status>Active</Status>
  </Parameters>
<Query>

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>

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


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:

<Parameters>
  <Name>State</Name>
  <Value>CA</Value>
</Parameters>

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.

thanks,

Nick K. Aghazarian

Received on Thursday, 27 July 2000 19:21:54 UTC