- From: kajoha <kajoha@gmx.at>
- Date: Mon, 13 Oct 2003 15:56:56 +0200 (MEST)
- To: xmlschema-dev@w3.org
hi, i've following xml-file: ===== <?xml version="1.0" encoding="UTF-8"?> <Contact xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:\XML\uniqueness.xsd"> <Name> <Surname>Doe</Surname> <Forename>John</Forename> </Name> <Name> <Surname>Moe</Surname> <Forename>John</Forename> </Name> <Name> <Surname>Toe</Surname> <Forename>John</Forename> </Name> . . . </Contact> ===== how must i define the unique element within the uniqueness.xsd file to assure that each Surname/Forename pair is unique within a xml-document? ===== <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="Contact"> <xs:complexType> <xs:sequence> <xs:element name="Name" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element name="Surname" type="xs:string"/> <xs:element name="Forename" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> <xs:unique name="idMustBeUnique"> <xs:selector xpath=".//Surname"/> <xs:field xpath="."/> </xs:unique> </xs:element> </xs:schema> ===== above given one only checks against double entries for Surname because of the given selector statement. i think it have something to do with the definition of the field elements, but until now i come not up with it. thanks for your help, johann kandl -- NEU FÜR ALLE - GMX MediaCenter - für Fotos, Musik, Dateien... Fotoalbum, File Sharing, MMS, Multimedia-Gruß, GMX FotoService Jetzt kostenlos anmelden unter http://www.gmx.net +++ GMX - die erste Adresse für Mail, Message, More! +++
Received on Monday, 13 October 2003 10:05:54 UTC