xpath节点提取库

时间:2014-03-19 14:36:37

标签: xml arrays xpath

如何为高度为400的图像提取图像sourceURL?下面是xml输出:

<imageList>
    <image available="true" height="100" width="100">
        <sourceURL>di/35/4b/49/5a5846562d77473973776e566b737757387877-100x100-0-0.jpg?rqid=p12.2aef1330047882eacc81&rqt=SRS&a=1&c=44&l=8079962&r=1&pr=1&lks=78809.4&fks=69208</sourceURL>
    </image>
    <image available="true" height="200" width="200">
        <sourceURL>images/di/35/4b/49/5a5846562d77473973776e566b737757387877-200x200-0-0.jpg?rqid=p12.2aef1330047882eacc81&rqt=SRS&a=1&c=44&l=8079962&r=1&pr=1&lks=78809.4&fks=69208</sourceURL>
    </image>
    <image available="false" height="300" width="300">
        <sourceURL>sc/ds/no_image_100X100.jpg?rqid=p12.2aef1330047882eacc81&rqt=SRS&a=1&c=44&l=8079962&r=1&pr=1&lks=78809.4&fks=69208</sourceURL>
    </image>
    <image available="false" height="400" width="400">
        <sourceURL>sc/ds/no_image_100X100.jpg?rqid=p12.2aef1330047882eacc81&rqt=SRS&a=1&c=44&l=8079962&r=1&pr=1&lks=78809.4&fks=69208</sourceURL>
    </image>
    <image available="true" height="215" width="200">
        <sourceURL>http://di67.shoppingshadow.com/images/di/35/4b/49/5a5846562d77473973776e566b737757387877-200x215-0-0.jpg?rqid=p12.2aef1330047882eacc81&rqt=SRS&a=1&c=44&l=8079962&r=1&pr=1&lks=78809.4&fks=69208</sourceURL>
    </image>
</imageList>

2 个答案:

答案 0 :(得分:1)

/imageList/image[@height < 400]/sourceURL

答案 1 :(得分:0)

您可以在路径中的image步骤中使用谓词,例如

/imageList/image[@height = 400]/sourceURL