Dare
Thanks for the response. I will attempt to construct a "simple example"
of this that illustrates the error I'm seeing. Of course in doing so
perhaps I'll find the error if it is indeed mine!
Bill
"Dare Obasanjo [MSFT]" <dareo@online.microsoft.com> wrote in message
news:%23gsnN6sREHA.3348@TK2MSFTNGP09.phx.gbl...[color=blue]
> The .NET Framework's XML Schema supports all aspects of XSD including
> derivation by restriction. There are probably errors in your schema.
>
> What you want to do is generally not possible with W3C XML Schema. You
> cannot create a "choice of attributes". You can define an abstract
> tableType, then define derived types fooTableType and barTableType but in
> addition should specify that the type of table is tableType in the schema
> then each instance declares whether it is a fooTableType or a barTableType
> using an xsi:type attribute.
>
> --
> This posting is provided "AS IS" with no warranties, and confers no[/color]
rights.[color=blue]
>
> "Bill Cohagan" <bill@teraXNOSPAMXquest.com> wrote in message
> news:%2328KPagREHA.644@tk2msftngp13.phx.gbl...[color=green]
> > I'd like to define a schema that allows, for example, a "table" element[/color]
> that[color=green]
> > takes on one of two forms distinguished by what attributes are present.[/color]
> For[color=green]
> > instance,
> >
> > <table foo="3"/>
> > <table bar="5"/>
> >
> > Note that I want to exclude <table foo="3" bar = "5"/>; i.e., using[/color][/color]
*both*[color=blue][color=green]
> > attributes should fail to validate.
> >
> > A familiar example of this sort of thing is the element named[/color][/color]
xsd:element[color=blue]
> in[color=green]
> > XML Schema itself. It can have a type attribute or a ref attribute, but[/color]
> not[color=green]
> > both. It would appear there are several ways to do this sort of thing.[/color][/color]
One[color=blue][color=green]
> > approach is to define an abstract tableType, then define derived types
> > fooTableType and barTableType. We could use extension in which case the
> > derived types would provide the associated attribute. Alternatively we[/color]
> could[color=green]
> > define both attributes in the base type, then derive by restriction,[/color]
> setting[color=green]
> > the use of the "excluded" attribute to prohibited. Both approaches seem[/color][/color]
to[color=blue][color=green]
> > work; i.e., the created XSD seems to past muster in the VS2003 IDE.
> >
> > The problem is that when I attempt to validate an XML against this XSD I[/color]
> get[color=green]
> > an error complaining that the schema is not deterministic due to[/color][/color]
multiple[color=blue][color=green]
> > elements named "table". Now I've read about the xsi:type attribute and[/color]
> tried[color=green]
> > adding that to see if it eliminated the ambiguity, but no joy.
> >
> > I found the schema for XML Schema at
> >
http://www.w3.org/TR/xmlschema-1/#no...e-schemaSchema and it uses
> > derivation by restriction to express this sort of thing. Apparently
> > Microsofts XML implementation however doesn't support this sort of
> > derivation.
> >
> > Have I missed something fundamental or is this simply not possible[/color][/color]
within[color=blue][color=green]
> > the VS2003 IDE and the .Net XML implementation?
> >
> > Thanks in advance for any suggestions or pointers.
> >
> > Bill
> >
> >[/color]
>
>[/color]