OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   XSD: Behaviour of <xsd:unique>

[ Lists Home | Date Index | Thread Index ]

Hello all,

I noticed three different behaviours with three different xml parsers with
the <xsd:unique> element. Can somebody give me an indication of which is the
right one. 

xsd file:
<xsd:schema xmlns:ipm="http://unique/test";
<xsd:element name="root">
			<xsd:element ref="ipm:mayHaveDaughter" minOccurs="0"
	<xsd:unique name="uniqueNode">
		<xsd:selector xpath="ipm:mayHaveDaughter"/>
		<xsd:field xpath="@f1"/>
		<xsd:field xpath="ipm:d"/>

<xsd:element name="mayHaveDaughter">
			<xsd:element name="d" minOccurs="0" maxOccurs="1"
		<xsd:attribute name="f1" type="xsd:string"/>


example xml file:

<?xml version="1.0"?>

<root xmlns="http://unique/test"; 
	  xsi:schemaLocation="http://unique/test unique.xsd">
 <mayHaveDaughter f1="a"/>
 <mayHaveDaughter f1="b"/>
 <mayHaveDaughter f1="c">
 <mayHaveDaughter f1="c">

What should be the behaviour when the optional tag <d> is missing. Both
MSXML 4.0 and xsdvalid still check on the f1 attribute. So if we leave out
the <d> tags in the example the file is invalid, because there are two
<mayHaveDaughter> elements with a f1 attribute value 'c'. However with xsv
no error is generated, and with XercesJ-2.3.0 I get following error: 'Not
enough values specified for <unique> identity constraint specified for

So my question is, if one of the optional elements is not available, should
this element be ignored or not. The recs seems to be not clear about that.

Kind regards,


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS