You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Rebekah Lepro <rs...@psu.edu> on 2001/02/06 19:51:03 UTC
support for ?
I've been trying to get validation to fail after violating the unique
requirement in a schema, and it doesn't seem to fail no matter what I
do. I took the example from the Schema primer too, and it fails. I see
that support is still experimental. Is this not yet supported or am I
doing something wrong? I've included the schema and the document that I
thought would fail validation because of the duplication within the code
attribute of zip. But it passes just fine?
Thanks,
Rebekah
Schema document:
<?xml version="1.0" encoding="UTF-8"?>
<x:schema xmlns:x="http://www.w3.org/2000/10/XMLSchema"
elementFormDefault="qualified" xmlns:r="http://www.example.com/Report">
<x:element name="purchaseReport">
<x:complexType>
<x:sequence>
<x:element minOccurs="1" maxOccurs="10"
name="regions" type="RegionsType"/>
</x:sequence>
</x:complexType>
<x:unique name="testing">
<x:selector xpath="regions/zip"/>
<x:field xpath="@code"/>
</x:unique>
</x:element>
<x:complexType name="RegionsType">
<x:sequence>
<x:element name="zip" maxOccurs="unbounded">
<x:complexType>
<x:sequence>
<x:element name="part"
maxOccurs="unbounded" type="PartType"/>
</x:sequence>
<x:attribute name="code"
type="x:positiveInteger"/>
</x:complexType>
</x:element>
</x:sequence>
</x:complexType>
<x:complexType name="PartType">
<x:sequence>
<x:element name="foo"/>
</x:sequence>
<x:attribute name="number" type="x:string"/>
<x:attribute name="quantity" type="x:positiveInteger"/>
</x:complexType>
</x:schema>
XML document
***********************
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v3.5 NT (http://www.xmlspy.com) by Rebekah Lepro
(Penn State University) -->
<purchaseReport xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="\\carina\e$\xml\data\Unique.xsd">
<regions>
<zip code="12565">
<part number="12" quantity="2">
<foo>hello</foo>
</part>
<part number="12" quantity="4">
<foo>hi</foo>
</part>
</zip>
<zip code="12565">
<part number="12" quantity="2">
<foo>hello</foo>
</part>
<part number="12" quantity="4">
<foo>hi</foo>
</part>
</zip>
</regions>
</purchaseReport>
Rebekah Lepro - rsl102@psu.edu
Applied Research Laboratory
The Pennsylvania State University
P.O. Box 30, State College PA 16804
Phone: +1-814-863-8122 Fax: +1-814-863-1183