I have the following XML:
<enumTypes xmlns="tempURI">
<enumType id="1">
<enumValue id="1" value="Item1"/>
<enumValue id="2" value="Item2"/>
<enumValue id="3" value="Item3"/>
</enumType>
<enumType id="2">
<enumValue id="1" value="Item1"/>
<enumValue id="2" value="Item2"/>
</enumType>
</enumTypes>
I also have the following diagram:
<xs:element name="enumTypes">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:element name="enumType">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:element name="enumValue">
<xs:complexType>
<xs:attribute name="id" type="xs:string" use="required"/>
<xs:attribute name="value" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:key name="enumTypeKey">
<xs:selector xpath="enumTypes/enumType"/>
<xs:field xpath="@id"/>
</xs:key>
<xs:key name="enumValueKey">
<xs:selector xpath="enumTypes/enumType/enumValue"/>
<xs:field xpath="@id"/>
</xs:key>
I am trying to make the enumValue identifier be unique WITHIN enumType, but so far I can only get it to make them unique in all enumTypes.
I assume there is a problem with my XPath selector, but I can’t understand that it figured out.
Any help would be appreciated!
source
share