472,975 Members | 1,746 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,975 software developers and data experts.

uniqueness across different child elements

I'm having a problem with the "unique" feature of XML Schema. I'm
relatively new to using this feature so it may be that I'm
misunderstanding something. Let's assume that I have the following
schema:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:element name="a">
<xs:complexType>
<xs:sequence>
<xs:element ref="b" maxOccurs="unbounded"/>
<xs:element ref="c" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:unique name="xUnique">
<xs:selector xpath="a|b"/>
<xs:field xpath="@x"/>
</xs:unique>
</xs:element>
<xs:element name="b">
<xs:complexType>
<xs:attribute name="x" type="xs:string"
use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="c">
<xs:complexType>
<xs:attribute name="x" type="xs:string"
use="required"/>
</xs:complexType>
</xs:element>
</xs:schema>

where an element "a" has two child elements "b" and "c". Each of these
child elements have a string attribute "x". "x" is supposed to be unique
within "a" regardless of whether it's in "b" or "c". I believe that the
above schema captures that.

However, the following document is valid according to XMLSpy and Xerces
when I believe that it is invalid:

<?xml version="1.0" encoding="UTF-8"?>
<a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="test.xsd">
<b x="foo"/>
<c x="foo"/>
</a>

Am I doing something wrong? Do I not have my xpath selector correctly
written? Is this a bug?

Don Bate
Jul 20 '05 #1
0 1475

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Puvendran Selvaratnam | last post by:
Hi, First of all my apologies if you have seen this mail already but I am re-sending as there were some initial problems. This query is related to defining indexes to be unique or not and...
4
by: Doug Estep | last post by:
Below is a sample of my XML <MetaData> <Table name="mytable"> <PrimaryKey name="pk"><Column name="mycolumn"/></PrimaryKey> </Table> </MetaData> <Sequencer> <Table name="mytable">
0
by: user | last post by:
Hi, I have the following xml <rootElem> <child type="Single"> <!-- if type is "single", then we can have only 1 of the following element with default for directory as "1" --> <childOfChild>
8
by: Hugh Sparks | last post by:
When processing an xml document that contains elements such as: <element xmlns="goop"/> ... <element xmlns="gleep"/> I want to create two xsl stylesheet templates: one that matches the...
10
by: Mike Dickens | last post by:
hi, suppose i have: <a> <b i="Y" j="aaaa"/> <c i="N" j="bbbb"/> <d i="Y" j="cccc"/> <e i="N" j="dddd"/> <f i="N" j="eeee"/> <g i="Y" j="ffff"/>
6
by: Andreas | last post by:
Hello list, what about uniqueness of inherited primary keys ? eg you have : create table objects ( id int4, date_created timestamp(0), primary key (id)
5
by: Alan Little | last post by:
I have affiliates submitting batches of anywhere from 10 to several hundred orders. Each order in the batch must include an order ID, originated by the affiliate, which must be unique across all...
3
by: PC Paul | last post by:
Hi, I have a problem that seems like it ought to be solvable with a couple of XPath statements but after a couple of days I can't find them.. Original XML: <People> <PartialPerson>...
1
by: yawnmoth | last post by:
<?php $content = ' <a> <d> <b> <c/><c/> </b> </d> <b> <c/><c/><c/>
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.