1

I am working on KONY platform.

I have a webservice response which is in XML format.It contains following tables:

and the Table has following fields :

As you can notice the fields of the table have some common field names : UID,CID,CPID

Now when i try to write xpath to extract the UID field of Expense Table XPATH : NewDAtaSet\Expense\UID

in response all the UID of other tables are also getting added along with Expense UID.

Can anyone please suggest how we can define XPATH in KONY so that we only get UID of Expense?

drkthng
  • 6,651
  • 7
  • 33
  • 53

2 Answers2

0

It's hard to really tell without you posting a sample of the actual xml, but Kony's Xpath implementation is standard. So assuming your xml looks like this:

<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>

Then the answer should be:

/NewDataSet/Expenses/expense/uid
Mig82
  • 4,856
  • 4
  • 40
  • 63
0

Try with the following one:

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

Then:

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

Now in code, get expense_details from the response object and iterate it to get the uid and name.

Leonardo Alves Machado
  • 2,747
  • 10
  • 38
  • 53