Re: [regrep] [XML Schema issue] Replace choice with type substitution

From
Chiusano Joseph <>
Date
2003-03-17T02:34:05+00:00
ID
Thread
Re: [regrep] [XML Schema issue] Replace choice with type substitution
Sorry for my confusion (I just brushed up on this technique in my handy
Wrox "Professional XML Schemas" book, as I haven't used it for some
time).

Sounds good to me.

Thanks also Nikola for the additional verification.

Joe

Farrukh Najmi wrote:
> 
> Team,
> 
> In new V3 schema we have consistently used type substitution instead of
> choice construct when defining XMl schema. Choice in the pinion of many
> is not very object oriented and implementation experience has shown that
> it complicates design.
> 
> I would like to ask if any one has objections if we replace occurrences
> of <choice> in the schema with type substitution. Here is an example of
> how teh proposal effects the schema:
> 
> Old Way
> --------
> In query.xsd the definition of AdhocQueryRequest looks like:
> 
> <sequence>
>    <element ref = "tns:ResponseOption" minOccurs="1" maxOccurs="1" />
>    <choice minOccurs="1" maxOccurs="1">
>      <element ref = "tns:FilterQuery"/>
>      <element ref = "tns:SQLQuery"/>
>    </choice>
> </sequence>
> 
> New Way
> -------
> Above Old Way would look like this under the proposal:
> 
> <sequence>
>    <element ref = "tns:ResponseOption" minOccurs="1" maxOccurs="1" />
>    <element name="Query" type="tns:AdhocQueryType" minOccurs="1" </sequence>
> 
> Where AdhocQueryType is the base type for both SQLQueryType and
> FilterQueryType.
> 
> Benefits
> ---------
> Now code can be written using Object oriented principals so that there
> is a AdhocQueryType class that is extended by SQLQueryType and
> FilterQueryType classes. Either type of query may be abstractly
> represented as a AdhocQueryType.
> 
> Thanks for your input on this issue.
> 
> ----------------------------------------------------------------
> To subscribe or unsubscribe from this elist use the subscription
> manager: <http://lists.oasis-open.org/ob/adm.pl>