Re: group or abstract type?

Mikael Joukakelian <mikaelj@cae.com> writes:

> Consider the following schema which, if I understood the email below
> correctly, is valid:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified" attributeFormDefault="unqualified">
> 	<xs:element name="AbstractMenuEntry" abstract="true"/>
> 	<xs:element name="MenuStructure">
> 		<xs:complexType>
> 			<xs:sequence>
> 				<xs:element ref="AbstractMenuEntry"
> maxOccurs="unbounded"/>
> 			</xs:sequence>
> 		</xs:complexType>
> 		<xs:unique name="menuIdConstraint">
> 			<xs:selector xpath="MenuEntry"/>
> 			<xs:field xpath="@menuId"/>
> 		</xs:unique>
> 	</xs:element>
> 	<xs:element name="MenuEntry" substitutionGroup="AbstractMenuEntry">
> 		<xs:complexType>
> 			<xs:attribute name="menuId"/>
> 		</xs:complexType>
> 	</xs:element>
> </xs:schema>
> 
> This validates in XML Spy, but not in MSXML4.0 and SQC2.1.1. Until recently,
> I was using XML Spy and life was easy, but I also need to use MSXML4.0 and I
> get the following error message from SQC2.1.1: 
> 
> SEVERITY: 0
> ERROR TYPE: 2
> MESSAGE
> No node in element MenuStructure corresponds to <xs:selector
> xpath="MenuEntry"/>
> 
>  defined in <xs:unique name="menuIdConstraint">
>     <selector xpath="MenuEntry"/>
>     <field xpath="@menuId"/>
> </xs:unique>
> . Invalid XPath starting from MenuStructure:MenuEntry.

Note this is SEVERITY: 0.  Your schema is valid.

> XML Spy doesn't even check if menuId exists anywhere, that is, changing
> <xs:field xpath="@menuId"/> to <xs:field xpath="@menuId777"/> would not
> generate an error. Would this be a W3C conformant schema even if menuId777
> does not exist? 

Yes.  There's nothing to stop you writing XPaths that are never satisfied.

ht
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2002, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/
 [mail really from me _always_ has this .sig -- mail without it is forged spam]

Received on Friday, 6 September 2002 05:37:05 UTC