【问题标题】:how to write xpath to select a value with 2 or more conditions如何编写 xpath 以选择具有 2 个或更多条件的值
【发布时间】:2015-06-24 20:17:22
【问题描述】:

以下是示例 xml:

我需要选择消息标签的值,即“xpath 语句结果”,条件为“Condition_1 = Extract”和“Condition_2 = AuthorizationViaV1”。

<Row1>
    <uniquekey>11110011</uniquekey>
    <TrackingID>level123</TrackingID>
    <timestamp>2015-06-12T13:28:44.959+05:30</timestamp>
    <acquiretime>500</acquiretime>
    <Condition_1>Login</Condition_1>
    <Condition_2>AuthorizationViaV1</Condition_2>
    <message>xpath statement result</message>
    <payload>abcdefghi</payload>
</Row1>

【问题讨论】:

  • 好的,这是非常基本和直接的。你试过自己解决吗?你被困在哪里了?

标签: xml xpath


【解决方案1】:

您可以在条件中使用and 布尔运算符:

Row1[Condition_1 = 'Extract' and Condition_2 = 'AuthorizationViaV1']/message

或者你可以链接条件:

Row1[Condition_1 = 'Extract'][Condition_2 = 'AuthorizationViaV1']/message

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-08-15
    • 2015-04-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-02
    • 1970-01-01
    相关资源
    最近更新 更多