11-03-2022 10:06 AM - edited 11-03-2022 10:08 AM
I have the below XML document in UCCX document management.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Numbers>
<DNIS>6022</DNIS>
<DNIS>6023</DNIS>
<DNIS>6024</DNIS>
<DNIS>6025</DNIS>
</Numbers>
When anyone call the UCCX application, script should compare the called number (CalledNumber Variable) with each DNIS row in the XML document and return true if CalledNumber and DNIS matches, if not return false if there are no matches found.
How can I achieve this? please help me on xpath to fetch the DNIS value one by one from XML so that I can compare inside my script.
Solved! Go to Solution.
11-04-2022 08:43 AM
11-03-2022 11:49 PM - edited 11-03-2022 11:50 PM
Have you tried to search for this in the community? With a minimum amount of effort you should be able to find examples of this, or at least as similar that would be usable enough for you to figure out how to do this, as it’s a type of topic that has come up on many occasions.
11-04-2022 07:29 AM
Yes Roger. I saw many examples, but using those examples, either returning Null value to my variable in Script or Java Exceptions error while running Reactive debug. I know this is a very simple and basic thing to identify xpath, but somewhere I am missing.
11-04-2022 08:43 AM
11-04-2022 10:56 AM - edited 11-06-2022 10:41 AM
Thanks Roger. Based on the video, I made some changes in my XML file and xpath, finally I got my required output.
Modified XML:
<Numbers>
<DNIS ID = "6022"><Number>6022</Number></DNIS>
<DNIS ID = "6023"><Number>6023</Number></DNIS>
<DNIS ID = "6024"><Number>6024</Number></DNIS>
<DNIS ID = "6025"><Number>6025</Number></DNIS>
</Numbers>
Working xpath: /Numbers/DNIS[@ID=6022]/Number
Output is: 6022
Generic variables used in script are below:
1) String Variable, xpath1 = "//DNIS[@ID="
2) String Variable DNIS = CalledNumber (variable value)
CalledNumber value will be fetched by script get call contact info step (called number variable)
3) String Variable xpath2 = "]/Number"
Final xpath to be included in get xml document data step is xpath1 + DNIS + xpath2
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: