Simple unique constraint fails across choice element
----------------------------------------------------
Key: XERCESC-1729
URL: https://issues.apache.org/jira/browse/XERCESC-1729
Project: Xerces-C++
Issue Type: Bug
Components: Validating Parser (Schema) (Xerces 1.5 or up only)
Affects Versions: 1.5, 1.5.1, 1.5.2, 1.6.0, 1.7.0, 2.0.0, 2.1.0, 2.2.0,
2.3.0, 2.4.0, 2.5.0, 2.6.0, 2.7.0
Environment: UNBUNTU 7.04 Intel
g++ 4.01
Reporter: Steve Baker
Priority: Blocker
Fix For: 2.7.0
Error while parsing xml- check against schema:
Failed to parse: Not enough values specified for <unique> identity constraint
for element 'Pairs'.
The problem occurs in 'UniqueDirectionStartObj1AcrossFile' where i ask that the
direction with the StartObj1 is unique across the file. StartObj1 is part of a
choice element where the choice is StartObj1 or StartObj2. When StartObj2
exists instead of StartObj1 Xerces complains that there are not enough values
for the unique contraint. This is the problem.
I would expect the code to say " there's no StartObj1 in this case so the
unique contraint doesn't apply, lets skip it in the case' but the code
complains that the hasn't got the values to complete the unique case.
If its not there don't apply the constraint!!!
XMLSpy handles this as i would expect.
the data...
<Pairs xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="TEST.xsd">
<Pair>
<Direction>UP</Direction>
<Start>
<StartObj1>20</StartObj1>
</Start>
</Pair>
<Pair>
<Direction>UP</Direction>
<Start>
<StartObj2>30</StartObj2>
</Start>
</Pair>
</Pairs>
the schema...
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="Pairs">
<xs:annotation>
<xs:documentation>Comment describing your root
element</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="Pair" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element
name="Direction"/>
<xs:element
name="Start">
<xs:complexType>
<xs:choice>
<xs:element name="StartObj1"/>
<xs:element name="StartObj2"/>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:unique name="UniqueDirectionStartObj1AcrossFile">
<xs:selector xpath="Pair"/>
<xs:field xpath="Direction"/>
<xs:field xpath="Start/StartObj1"/>
</xs:unique>
</xs:element>
</xs:schema>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]