- From: Rick Taylor <taylor@ppdm.org>
- Date: Mon, 29 Apr 2002 14:42:08 -0400 (EDT)
- To: xmlschema-dev@w3.org
Can someone please verify that the construct below is correct. MSXML 4.0 produces an error when validating with a key on a field that has been defined as a complexType with simpleContent. I assume this is a bug in MSXML as the Xerces and XSV parsers do not complain. I modified one of Roger Costello's samples to demonstrate the problem. <?xml version="1.0"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.books.org" xmlns="http://www.books.org" xmlns:bk="http://www.books.org" elementFormDefault="qualified"> <xsd:element name="BookStore"> <xsd:complexType> <xsd:sequence> <xsd:element name="Book" maxOccurs="unbounded"> <xsd:complexType> <xsd:sequence> <xsd:element name="Title" type="xsd:string"/> <xsd:element name="Author" type="xsd:string"/> <xsd:element name="Date" type="xsd:string"/> <xsd:element name="ISBN" type="bk:ISBNBaseType"/> <!-- comment out the former and un-comment the following and MSXML produces the error --> <!-- <xsd:element name="ISBN" type="bk:ISBNBaseType2"/> --> <xsd:element name="Publisher" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> <xsd:key name="PK"> <xsd:selector xpath="bk:Book"/> <xsd:field xpath="bk:ISBN"/> </xsd:key> </xsd:element> <xsd:simpleType name="ISBNBaseType"> <xsd:restriction base="xsd:string"> <xsd:pattern value="\d{1}-\d{5}-\d{3}-\d{1}"/> <xsd:pattern value="\d{1}-\d{3}-\d{5}-\d{1}"/> <xsd:pattern value="\d{1}-\d{2}-\d{6}-\d{1}"/> </xsd:restriction> </xsd:simpleType> <!-- Notice that the only difference between the definitions ISBNBaseType and ISBNBaseType2 is that the latter allows the attribute 'description' to be present --> <xsd:complexType name="ISBNBaseType2"> <xsd:simpleContent> <xsd:restriction base="bk:attr_string"> <xsd:pattern value="\d{1}-\d{5}-\d{3}-\d{1}"/> <xsd:pattern value="\d{1}-\d{3}-\d{5}-\d{1}"/> <xsd:pattern value="\d{1}-\d{2}-\d{6}-\d{1}"/> </xsd:restriction> </xsd:simpleContent> </xsd:complexType> <xsd:complexType name="attr_string"> <xsd:simpleContent> <xsd:extension base="xsd:string"> <xsd:attribute name="description" type="xsd:string" use="optional"/> </xsd:extension> </xsd:simpleContent> </xsd:complexType> </xsd:schema> Thanks Rick Taylor XML Developer PPDM Association
Received on Wednesday, 1 May 2002 04:53:56 UTC