Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
具有节点集的XSD标识约束_Xsd_Constraints - Fatal编程技术网

具有节点集的XSD标识约束

具有节点集的XSD标识约束,xsd,constraints,Xsd,Constraints,由于对实例中的节点集求值的字段,我在生成标识约束时遇到问题 给定一组XML示例: <data> <Clusters> <Cluster FileID="0" Function="1"> <Isotopes> <Isotope StickID="0"/> <Isotope StickID="1"/>

由于对实例中的节点集求值的字段,我在生成标识约束时遇到问题

给定一组XML示例:

<data>
    <Clusters>
        <Cluster FileID="0" Function="1">
            <Isotopes>
                <Isotope StickID="0"/>
                <Isotope StickID="1"/>
            </Isotopes>
        </Cluster>
        <Cluster FileID="0" Function="2">
            <Isotopes>
                <Isotope StickID="2"/>
            </Isotopes>
        </Cluster>
    </Clusters>
</data>

我试图创建一个约束,这样对于给定的同位素元素,@StickID与祖父母集群的@FileID和@Function的每个组合都必须形成一个唯一的键

如果从数据上下文中,我将集群上的选择器定义为:

<xs:key name="ClusterStickRefIdentity">
    <xs:selector xpath="Clusters"/>
    <xs:field xpath="Cluster/Isotopes/Isotope/@StickID"/>
    <xs:field xpath="@Function"/>
    <xs:field xpath="@FileID"/>
</xs:key>

正如预期的那样,验证实例时会生成一个错误,即第一个字段的计算结果是一个包含多个成员的节点集,因为同位素元素可以包含无限数量的同位素元素

我的印象是字段只能应用于子上下文,这意味着我不能将选择器定义到集群之外的任何节点,或者我可以吗?是否可以构建我正在寻找的约束