Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Validator ignores my <xs:unique>

Thread Tools

Validator ignores my <xs:unique>

Ulf Heyder
Posts: n/a
Hello everyone,

I want to add a unique constraint to a XSD I created.

After I modified validation (XMLSpy, Castor-0.9.5 marshaller) of my
example (see below) against the XSD (also see below) doesn't lead to
any errors/warnings.

I tried several different combinations for the <xs:selector> and

Does anyone have an idea what I do wrong?

Thanks, Ulf

--- UniqueTest.xsd ---------------------------------

<?xml version="1.0" encoding="UTF-8"?>
xmlns:test="" elementFormDefault="qualified"
<!-- -->
<xs:element name="liste">
<xs:element name="objekt" type="testbjektType"
<xs:unique name="unq">
<xs:selector xpath="liste"/>
<xs:field xpath="objekt/@nummer"/>
<!-- -->
<xs:complexType name="objektType">
<xs:element name="beschreibung" type="xs:string"/>
<xs:element name="typ" type="xs:string"/>
<xs:attribute name="nummer" use="required">
<xs:restriction base="xs:integer">
<xs:minInclusive value="1"/>
<xs:maxInclusive value="9999"/>

--- UniqueTest.xml ---------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v5 U ( by DAVID ibR (ibR
Ges. für Geoinformation mbH) -->
xsi:schemaLocation=" UniqueTest.xsd">
<objekt nummer="123">
<objekt nummer="123">
<objekt nummer="234">
<objekt nummer="345">
Reply With Quote
Itay Zandbank
Posts: n/a
> Hello everyone,
> I want to add a unique constraint to a XSD I created.
> Does anyone have an idea what I do wrong?

You need to fully qualify your XPath expression, like so:

<xs:unique name="unq">
<xs:selector xpath="test:liste"/>
<xs:field xpath="testbjekt/@nummer"/>

Hope this helps.
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Struts Validator - creditCard validator Java 4 02-13-2007 08:32 PM
ISE Testbench/Schematic Generation ignores package Dipl.-Ing. Hanns-Walter Schulz VHDL 5 04-26-2005 02:45 PM
VC6 Compiler ignores Array indexing? Ultraman Aries MCSD 2 06-05-2004 01:46 PM
Mozilla Firefox ignores GetRight. Watchman Firefox 1 04-08-2004 07:59 AM
formsauthentication ignores web.config Dirk Meusel ASP .Net 4 08-29-2003 06:17 PM