1

我附上了我的 xsd 的截断版本

<?xml version="1.0" encoding="UTF-8"?>

<xs:complexType name="School_ip_details">
    <xs:sequence>
        <xs:element type="xs:string" name="Tarun_Name" />
        <xs:element type="xs:string" name="Tarun_IP" />
        <xs:element type="xs:string" name="Tarun_Subnet" />

    </xs:sequence>
</xs:complexType>

<xs:element name="CLASSESS">
    <xs:complexType>
        <xs:sequence>
            <xs:element name="Taruns">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="Tarun" maxOccurs="127">
                            <xs:complexType>
                                <xs:sequence>
                                    <xs:element type="xs:string" name="Tarun_Name" />
                                    <xs:element type="xs:string" name="Tarun_Prefix" />
                                    <xs:element type="xs:string" name="Tarun_Subnet" />
                                </xs:sequence>
                            </xs:complexType>
                        </xs:element>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>



            <xs:element name="Schools">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="School">
                            <xs:complexType>
                                <xs:sequence>
                                    <xs:element name="School_IPdetails" type="School_ip_details" />
                                </xs:sequence>
                            </xs:complexType>
                        </xs:element>
                    </xs:sequence>
                </xs:complexType>

                <xs:keyref name="TarunRef" refer="TarunKey">
                    <xs:selector xpath="." />
                    <xs:field xpath="./School/School_IPdetails/Tarun_Name" />

                </xs:keyref>
            </xs:element>

        </xs:sequence>
    </xs:complexType>
    <xs:key name="TarunKey">
        <xs:selector xpath="./Taruns/Tarun/Tarun_Name" />

        <xs:field xpath="." />
    </xs:key>

    <xs:key name="TarunIPKey">
        <xs:selector xpath="./Taruns/Tarun/Tarun_Prefix" />
        <xs:field xpath="." />
    </xs:key>

</xs:element>

这里我想实现以下场景。当我提到任何值CLASSES/Taruns/Tarun/Tarun_Name时,该特定CLASSES/Scools/School/School_ip_details/Tarun_Name值的值应反映在CLASSES/Taruns/Tarun/Tarun_PrefixTarun_NameCLASSES/Scools/School/School_ip_details/Tarun_IP

请帮助我

4

1 回答 1

0

在您的 XSD 参考指南中查找身份约束(唯一、密钥和 keyref)。(您没有 XSD 参考指南吗?获取一份。)

于 2013-02-08T20:56:58.103 回答