Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/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
Algorithm 如何为某些元素名从XSD派生可能的XPath表达式?_Algorithm_Xslt_Xpath_Xsd - Fatal编程技术网

Algorithm 如何为某些元素名从XSD派生可能的XPath表达式?

Algorithm 如何为某些元素名从XSD派生可能的XPath表达式?,algorithm,xslt,xpath,xsd,Algorithm,Xslt,Xpath,Xsd,我现在正在努力自动生成XPath,从而生成某种类型的XSD模式 在本例中,我希望得到指向“firstName”和“lastName”的XPath,这意味着: root/Friend/firstName、root/Friend/lastName、root/TenthGrader/firstName、root/TenthGrader/lastName、root/complementdperson/oldSelf/firstName、root/complementdperson/oldSelf/las

我现在正在努力自动生成XPath,从而生成某种类型的XSD模式

在本例中,我希望得到指向“firstName”和“lastName”的XPath,这意味着:

root/Friend/firstName、root/Friend/lastName、root/TenthGrader/firstName、root/TenthGrader/lastName、root/complementdperson/oldSelf/firstName、root/complementdperson/oldSelf/lastName

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="root">
    <xs:complexType>
        <xs:sequence>
            <xs:element name="Friend" type="Student"/>
            <xs:element name="TenthGrader">
                <xs:complexType>
                    <xs:complexContent>
                        <xs:extension base="Student">
                            <xs:element name="Sexyteacher"/>
                        </xs:extension>
                    </xs:complexContent>
                </xs:complexType>
            </xs:element>
            <xs:element ref="complicatedPerson"/>
            <xs:element name="IdoNothing"/>
        </xs:sequence>
    </xs:complexType>
</xs:element>

<xs:element name="complicatedPerson" type="Person"/>

<xs:complexType name="Person">
    <xs:sequence>
        <xs:element name="oldSelf" type="Student"/>
        <xs:element name="Age" type="xs:int"/>
    </xs:sequence>
</xs:complexType>

<xs:complexType name="Student">
    <xs:sequence>
        <xs:element name="firstName"/>
        <xs:element name="lastName"/>
    </xs:sequence>
</xs:complexType>

</xs:schema>

这已经让我头疼了

有没有已知的方法可以做到这一点


提前非常感谢

您需要创建逻辑以满足需要。你可能会从中得到一些想法,你的意思是我需要使用/创建一个函数吗?