【问题标题】:Defining Kony XPATH定义 Kony XPATH
【发布时间】:2017-12-27 23:56:19
【问题描述】:

我在 KONY 平台上工作。

我有一个 XML 格式的 Web 服务响应。它包含以下表格:

表格有以下字段:

如您所见,表格的字段有一些常见的字段名称:UID、CID、CPID

现在,当我尝试编写 xpath 来提取费用表的 UID 字段时 XPATH:NewDAtaSet\Expense\UID

作为响应,其他表的所有 UID 也会与费用 UID 一起添加。

谁能建议我们如何在 KONY 中定义 XPATH,以便我们只获得 Expense 的 UID?

【问题讨论】:

    标签: xml xpath temenos-quantum


    【解决方案1】:

    如果不发布实际 xml 的示例,很难真正判断,但 Kony 的 Xpath 实现是标准的。所以假设你的 xml 看起来像这样:

    <NewDataSet>
        <Expenses>
            <expense>
                <uid>1</uid>
                <name>foo</name>
            </expense>
            <expense>
                <uid>2</uid>
                <name>bar</name>
            </expense>
        </Expenses>
        <Times>
            <time>
                <uid>3</uid>
                <StartTime>3414265457667</StartTime>
            </time>
        </Times>
    </NewDataSet>
    

    那么答案应该是:

    /NewDataSet/Expenses/expense/uid
    

    【讨论】:

      【解决方案2】:

      尝试以下方法:

      id: expense_details; xpath: /NewDataSet/Expenses/expense 
      

      然后:

      id: uid; xpath: /uid; Collections: expense_details(it is the one, which we have given in the above.)
      
      id: name; xpath: /name; Collections: expense_details
      

      现在在代码中,从响应对象中获取费用详细信息并对其进行迭代以获取 uidname

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-05-26
        • 2015-11-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多