DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11094>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11094

selector xpath containing alternatives does not work

           Summary: selector xpath containing alternatives does not work
           Product: Xerces2-J
           Version: 2.0.2
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: XML Schema Structures
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Latest Xerces validates the following document without errors:

<?xml version="1.0" encoding="UTF-8"?>
<test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:noNamespaceSchemaLocation="key.xsd">
    <e1 id="1"/>
    <e2 id="1"/>
    <e2 id="1"/>
</test>

against the following schema:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
    <xs:element name="test">
        <xs:complexType>
            <xs:choice maxOccurs="unbounded" minOccurs="1">
                <xs:element ref="e1"/>
                <xs:element ref="e2"/>
            </xs:choice>
        </xs:complexType>
        <xs:key name="test">
            <xs:selector xpath="e1|e2"/>
            <xs:field xpath="@id"/>
        </xs:key>
    </xs:element>
    <xs:element name="e1">
        <xs:complexType>
            <xs:attribute name="id" type="xs:string"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="e2">
        <xs:complexType>
            <xs:attribute name="id" type="xs:string"/>
        </xs:complexType>
    </xs:element>
</xs:schema>

replacing 
 <xs:selector xpath="e1|e2"/>
with
 <xs:selector xpath="*"/>

I get the following errors:

Duplicate key value [ID Value:  1] declared for identity constraint of 
element "test". (4:1)

Duplicate key value [ID Value:  1] declared for identity constraint of 
element "test". (5:1)

It seems that only the expression before the first "|" is taken into account.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to