W3C home > Mailing lists > Public > xmlschema-dev@w3.org > March 2002

RE: MSXML application of substitution groups to locally defined elements

From: Dare Obasanjo <dareo@microsoft.com>
Date: Wed, 13 Mar 2002 18:58:32 -0800
Message-ID: <8BD7226E07DDFF49AF5EF4030ACE0B7E055715E9@red-msg-06.redmond.corp.microsoft.com>
To: "Mark Feblowitz" <mfeblowitz@frictionless.com>
Cc: "Xmlschema-Dev (E-mail)" <xmlschema-dev@w3.org>
Yeah, you're right. This is a bug in MSXML which should be fixed in the
next service pack. 

I'll keep you posted as to its availability. 


-- 
THINGS TO DO IF I BECOME AN EVIL OVERLORD #5
The artifact which is the source of my power will not be kept on the
Mountain
of Despair beyond the River of Fire guarded by the Dragons of Eternity.
It 
will be in my safe-deposit box. The same applies to the object which is
my 
one weakness.


> -----Original Message-----
> From: Mark Feblowitz [mailto:mfeblowitz@frictionless.com] 
> Sent: Wednesday, March 13, 2002 7:01 AM
> To: Dare Obasanjo
> Cc: 'Xmlschema-Dev (E-mail)'
> Subject: MSXML application of substitution groups to locally 
> defined elements
> 
> 
> (Re-sending with a corrected Subject line and inlined xsd and 
> xml files).
> 
> As I understand it, substitution groups don't apply in the 
> case of locally bound elements.
> 
> So the complex type 
> 
> <xs:complexType name="OL">
>         <xs:sequence>
>  	  <xs:element name="Note" type="Note" minOccurs="0" 
> maxOccurs="unbounded" />
>  	  <xs:element name="ShipNote" type="Note" minOccurs="0" 
> maxOccurs="unbounded" />
>         </xs:sequence>
>  </xs:complexType>
> 
> Wouldn't even be subject to the conversion to an equivalent 
> choice group.
> 
> If, on the other hand, the complex type were defined as 
> 
> <xs:complexType name="OL">
>         <xs:sequence>
>  	  <xs:element ref="Note" minOccurs="0"  maxOccurs="unbounded" />
>  	  <xs:element ref="ShipNote" minOccurs="0" 
> maxOccurs="unbounded" />
>         </xs:sequence>
>  </xs:complexType>
> 
> then there would indeed be a problem - the first Note 
> occurrence would expand to the equivalent choice group,
> 
> <xs:complexType name="OL">
>         <xs:sequence>
> 	<xs:choice>
>  	  <xs:element ref="Note" minOccurs="0"  maxOccurs="unbounded" />
>  	  <xs:element ref="ShipNote" minOccurs="0" 
> maxOccurs="unbounded" />
> 	</xs:choice>
> 	<xs:element ref="ShipNote" minOccurs="0" 
> maxOccurs="unbounded" />
>         </xs:sequence>
>  </xs:complexType>
> 
> Thus leading to the nondeterminism. 
> 
> But the case I'm dealing with should suffer from no such 
> problem, since the elements are locally bound.
> 
> I've CC'ed the Schema Dev list for confirmation of this.
> 
> Mark
> 
> --------------------------------------------------------------
> --------------
> ----
>  
> Mark Feblowitz                                   [t] 617.715.7231
> Frictionless Commerce Incorporated     [f] 617.495.0188 
> XML Architect                                     [e]
> mfeblowitz@frictionless.com
> 400 Technology Square, 9th Floor 
> Cambridge, MA 02139 
> www.frictionless.com  
>  
> 
>  -----Original Message-----
> From: 	Dare Obasanjo [mailto:dareo@microsoft.com] 
> Sent:	Wednesday, March 13, 2002 1:33 AM
> To:	Mark Feblowitz
> Subject:	RE: Is anySimpleType a real type?
> 
> Slight correction...
> 
> 
> > -----Original Message-----
> > From: Dare Obasanjo
> > Sent: Tuesday, March 12, 2002 10:24 PM
> > To: 'Mark Feblowitz'
> > Subject: RE: Is anySimpleType a real type?
> > 
> > 
> > On investigation, I believe that MSXML is not in error.
> > 
> > Your complexType in question is defined as
> > 
> > 	<xs:complexType name="OL">
> >        <xs:sequence>
> > 	  <xs:element name="Note" type="Note" minOccurs="0"
> > maxOccurs="unbounded" />
> > 	  <xs:element name="ShipNote" type="Note" minOccurs="0" 
> > maxOccurs="unbounded" />
> > 	 </xs:sequence>
> > 	</xs:complexType>
> > 
> > which after the substitionGroups are applied becomes
> > 
> > 	<xs:complexType name="OL">
> >        <xs:sequence>
> 
> >         <xs:choice>
> > 	   <xs:element name="Note" type="Note" minOccurs="0"
> > maxOccurs="unbounded" />
> > 	   <xs:element name="ShipNote" type="ShipNote" 
> > minOccurs="0" maxOccurs="unbounded" />
> > 	  </xs:choice>
> 
> The above should be 
> 
> 	 <xs:choice minOccurs="0"  maxOccurs="unbounded">
>  	   <xs:element name="Note" type="Note"  />
>  	   <xs:element name="ShipNote" type="ShipNote" />
>        </xs:choice>	
> 
> > 	  <xs:element name="ShipNote" type="Note" minOccurs="0"
> > maxOccurs="unbounded" />
> > 	 </xs:sequence>
> > 	</xs:complexType>	
> > 
> > Which to me is ambiguous once the user because upon seeing a
> > <ShipNote> the parser cannot tell if it is the <ShipNote> 
> > that is part of the <xs:choice> content model or the 
> > <ShipNote> that comes immediately after the <xs:choice>. 
> 
> > > -----Original Message-----
> > > From: Mark Feblowitz [mailto:mfeblowitz@frictionless.com]
> > > Sent: Tuesday, March 12, 2002 5:20 PM
> > > To: Dare Obasanjo
> > > Subject: RE: Is anySimpleType a real type?
> > > 
> > > 
> > > Dare -
> > > 
> > > I've attached an xsd and an xml file demonstrating the 
> > > nondeterminism problem.
> > > 
> 
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified" attributeFormDefault="unqualified">
> 	<xs:element name="OL" type="OL"/>
> 	<xs:complexType name="OL">
> 		<xs:sequence>
> 			<xs:element name="Note" type="Note" 
> minOccurs="0" maxOccurs="unbounded"/>
> 			<xs:element name="ShipNote" type="Note"
> minOccurs="0" maxOccurs="unbounded"/>
> 		</xs:sequence>
> 	</xs:complexType>
> 	<xs:element name="ShipNote" type="ShipNote" 
> substitutionGroup="Note"/>
> 	<xs:complexType name="ShipNote">
> 		<xs:simpleContent>
> 			<xs:extension base="Note"/>
> 		</xs:simpleContent>
> 	</xs:complexType>
> 	<xs:element name="Note" type="Note"/>
> 	<xs:complexType name="Note">
> 		<xs:simpleContent>
> 			<xs:extension base="LingualString">
> 				<xs:attribute name="author"
> type="xs:string"/>
> 				<xs:attribute name="entryDateTime"
> type="DateTime"/>
> 			</xs:extension>
> 		</xs:simpleContent>
> 	</xs:complexType>
> 	<xs:simpleType name="DateTime">
> 		<xs:restriction base="xs:dateTime">
> 			<xs:pattern 
> value="\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d(Z|(\+|-)\d\d:\d\d)"/>
> 		</xs:restriction>
> 	</xs:simpleType>
> 	<xs:complexType name="LingualString">
> 		<xs:simpleContent>
> 			<xs:extension base="xs:string">
> 				<xs:attribute name="lang"
> type="xs:language"/>
> 			</xs:extension>
> 		</xs:simpleContent>
> 	</xs:complexType>
> </xs:schema>
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <OL xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="MSXMLBug.xsd">
> 	<Note lang="en-us" author="String" 
> entryDateTime="2001-12-17T09:30:47-05:00">String</Note>
> 	<ShipNote lang="en-us" author="String" 
> entryDateTime="2001-12-17T09:30:47-05:00">String</ShipNote>
> </OL>
> 
> 
> 
> > > Validating the file MSXMLBug.xml as-is results in a message
> > > about the schema being nondeterministic.
> > > 
> > > When I remove the substitutionGroup="Note" from the ShipNote 
> > > element, the validates completes without errors.
> > > 
> > > My best guess here is that the validator is treating the local 
> > > elements Note and ShipNote as global elements. With this 
> being the 
> > > case, the Note substitution group head could contain 
> either a Note 
> > > or a ShipNote element, leading to the nondeterminism.
> > > 
> > > My understanding of the Schema Rec is that local elements cannot 
> > > participate in substitution groups.
> > > 
> > > Is this a known MSXML bug?
> > > 
> > > Thanks for your help,
> > > 
> > > Mark
> > > 
>  
> 
Received on Wednesday, 13 March 2002 21:59:05 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:30 GMT