Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.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
基于其他值获取值的xpath表达式_Xpath - Fatal编程技术网

基于其他值获取值的xpath表达式

基于其他值获取值的xpath表达式,xpath,Xpath,我有下面的xml,我希望能够得到tel值,其中类型值=1 我尝试了很多不同的场景,并得出以下结论:; //电话/type[text()='1']/parent::tel但这不起作用。请找个人帮忙 <Telephone> <Number> <tel>01242123456</tel> <CountryCode>GB</CountryCode> <CountryDia

我有下面的xml,我希望能够得到tel值,其中类型值=1

我尝试了很多不同的场景,并得出以下结论:;
//电话/type[text()='1']/parent::tel
但这不起作用。请找个人帮忙

<Telephone>
    <Number>
        <tel>01242123456</tel>
        <CountryCode>GB</CountryCode>
        <CountryDiallingCode>+44</CountryDiallingCode>
    </Number>
    <type>1</type>
</Telephone>
<Telephone>
    <Number>
        <tel>07777777777</tel>
        <CountryCode>GB</CountryCode>
        <CountryDiallingCode>+44</CountryDiallingCode>
    </Number>
    <type>3</type>
</Telephone>

01242123456
国标
+44
1.
07777777777
国标
+44
3.
试试看 //电话[类型='1']/号码/电话