- From: Stephane Pageau <spageau@sed.ara.com>
- Date: Wed, 22 Aug 2001 11:30:41 -0400
- To: <xmlschema-dev@w3.org>
The following schema: <?xml version="1.0"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.books.org" xmlns:b="http://www.books.org" elementFormDefault="qualified"> <xsd:element name="GlobalDescription"> <xsd:complexType> <xsd:sequence> <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="xsd:string"/> <xsd:element name="Publisher" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> <xsd:key name="PK"> <xsd:selector xpath="b:BookStore/b:Book"/> <xsd:field xpath="b:ISBN"/> </xsd:key> </xsd:element> </xsd:schema> when used with the XSV or Xerces parser for the instance below properly indicates that the instance below has a duplicate ISBN and that is not allowed because of the "xsd:key" usage above. However, if I eliminate all references to namespace b: from the instance below, the XSV or Xerces parser no longer catches the duplicate ISBN number. These parsers report that there is no error. I would think that I should be able to choose a default namespace in the instance and still get the same behavior while parsing. Can someone tell me if there is something I am not understanding properly? <?xml version="1.0"?> <b:GlobalDescription xmlns:b="http://www.books.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http://www.books.org BookStore.xsd"> <b:BookStore> <b:Book> <b:Title>My Life and Times</b:Title> <b:Author>Paul McCartney</b:Author> <b:Date>1998</b:Date> <b:ISBN>0-440-34319-4</b:ISBN> <b:Publisher>McMillin Publishing</b:Publisher> </b:Book> <b:Book> <b:Title>Illusions The Adventures of a Reluctant Messiah</b:Title> <b:Author>Richard Bach</b:Author> <b:Date>1977</b:Date> <b:ISBN>0-440-34319-4</b:ISBN> <b:Publisher>Dell Publishing Co.</b:Publisher> </b:Book> <b:Book> <b:Title>The First and Last Freedom</b:Title> <b:Author>J. Krishnamurti</b:Author> <b:Date>1954</b:Date> <b:ISBN>0-06-064831-7</b:ISBN> <b:Publisher>Harper & Row</b:Publisher> </b:Book> </b:BookStore> </b:GlobalDescription> Stephane Pageau 811 Spring Forest Rd, Suite 100 Raleigh, NC 27609 mailto:spageau@sed.ara.com (919)876-0018 fax: (919) 878-3672
Received on Wednesday, 22 August 2001 11:31:12 UTC