cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
630
Views
10
Helpful
6
Replies

XML document

j.huizinga
Level 6
Level 6

Hello

I want to have a UCCX script that checks an XML file and using XPATH I can get somw information (in this case the name)

This is the XML

<Mobile-Numbers>
<employees>
<num>1234567890</num>
<name>John Smit</name>
</employees>
</Mobile-Numbers>

The XPATH would be: /Mobile-Numbers/employees[num="1234567890"]/name to get the name

But in the XML document each person requires two lines (<num> and <name>)

Is it not possible to have the number and the name on one line?

Thanks

 

JH

6 Replies 6

The easiest path will be to get this in two steps, one per line. Another method would be to change your XML format and collapse both fields together. Finally, the last one is to create a custom Java to do this, but that's way too much effort.

david

j.huizinga
Level 6
Level 6

Thank you for your reply

I am not an XML expert, how would you collaps both fields together? Can you give an example using the above XML?

Thanks you!

JH

It could look something like this:

<Mobile-Numbers>
<employees>
<num>1234567890 John Smit</num>
</employees>
</Mobile-Numbers>

Then you have to split the num from the name. Honestly, I would just do this in two steps to get each field. That's your fastest way forward.

david

j.huizinga
Level 6
Level 6

Thank you all

In the end with some searching I have now this:

<Mobile-Numbers>
<employees>
<num id="1111111111">TEXT1</num>
<num id="2222222222">TEXT2</num>
<num id="3333333333">TEXT3</num>
</employees>
</Mobile-Numbers>

"//num[@id='"+ CallingNumber +"' ]"

And this works for me. I only need one variable (the TEXT) if you need more variables, then this is not workinmgh I believe

JH

 

Always awesome to have people post their solution. Thank you!

david