cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
985
Views
0
Helpful
5
Replies

Get XML Document Data Issue

After tweak bunch of times the argument inside "Get XML Document Data" I´m still not able to obtain a no null value. Could someone help me to find out what i´m doing wrong?

<?xml version="1.0" encoding="UTF-8"?>

<Holidays>

  <Holiday>Date=1/2/2013</Holiday>

  <Holiday>Date=1/2/2013</Holiday>

  <Holiday>Date=8/4/2013</Holiday>

  <Holiday>Date=9/4/2013</Holiday>

  <Holiday>Date=1/5/2013</Holiday>

  <Holiday>Date=17/5/2013</Holiday>

  <Holiday>Date=27/5/2013</Holiday>

  <Holiday>Date=6/6/2013</Holiday>

  <Holiday>Date=23/6/2013</Holiday>

  <Holiday>Date=6/4/2013</Holiday>

  <Holiday>Date=25/12/2013</Holiday>

  <Holiday>Date=26/12/2013</Holiday>

</Holidays>

Xpath:

"/descendant::Holidays/child::Holiday[attribute::symbol='DateString']/child::LAST"

thank in advance.

1 Accepted Solution

Accepted Solutions

Hi,

(sigh). Alright.

1. Modify your XML:

  1/2/2013

  1/2/2013

  8/4/2013

  9/4/2013

  1/5/2013

  17/5/2013

  27/5/2013

  6/6/2013

  23/6/2013

  6/4/2013

  25/12/2013

  26/12/2013

2. Modify your XPath:

"/Holidays/Holiday[text()='" + needle + "']"

needle is a String variable that contains the value you want to match in the above XML. In your case its name is "DateString".

This XPath will return a String (actually, the match) if it matches so if needle=='1/2/2013', it will return '1/2/2013'

It will return null if there's no match.

G.

View solution in original post

5 Replies 5

Gergely Szabo
VIP Alumni
VIP Alumni

Hi,

what is it you are trying to achieve?

G.

Hi,

The script first obtain today´s date in this format 1/2/2013 and stores in DateString variable. Then create a XML document based on this:

  Date=1/2/2013

  Date=1/2/2013

  Date=8/4/2013

  Date=9/4/2013

  Date=1/5/2013

  Date=17/5/2013

  Date=27/5/2013

  Date=6/6/2013

  Date=23/6/2013

  Date=6/4/2013

  Date=25/12/2013

  Date=26/12/2013

that i´ve upload to uccx. it uses get XML Document Data function and stores the result in DataResult variable.

if

DataResult == null meets True it makes a call redirect to an extension

if false that means "1/2/2013" was found inside the XML archive and sends to another extension.

The problem i see through reactive debug is that always return null,

In brief: I do not know how to tell using the function "find 1/2/2013 inside Holidays.xml document"

this is what I putted inside get XML Document Data function:

"/descendant::Holidays/child::Holiday[attribute::symbol='DateString']/child::LAST"


Hi,

(sigh). Alright.

1. Modify your XML:

  1/2/2013

  1/2/2013

  8/4/2013

  9/4/2013

  1/5/2013

  17/5/2013

  27/5/2013

  6/6/2013

  23/6/2013

  6/4/2013

  25/12/2013

  26/12/2013

2. Modify your XPath:

"/Holidays/Holiday[text()='" + needle + "']"

needle is a String variable that contains the value you want to match in the above XML. In your case its name is "DateString".

This XPath will return a String (actually, the match) if it matches so if needle=='1/2/2013', it will return '1/2/2013'

It will return null if there's no match.

G.

It worked good, thank you so much! you saved my live! jejeje

Glad it worked out and thanks for the rating.

G.