Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. If you'd prefer to explore, try our test area to get started. And see here for current known issues.

New Member

CSQ Prefs from XML File

I'm looking to have a single script read individual CSQ prefs from an XML file. When I test with static values for the CSQ name in the Get XML Step, I get null values returned if the string is text. If it is numeric, it works.

This one fails with 'null' returned to the opt_ManualCloseCSD variable:

"/descendant::prefs/child::CSQ[@ID=CustomerService]/child::opt_ManualCloseCSD"

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

<prefs>
    <CSQ ID="CustomerService">
        <opt_ManualCloseCSD>true</opt_ManualCloseCSD>

    </CSQ>

    <CSQ ID="SAS">
        <opt_ManualCloseCSD>false</opt_ManualCloseCSD>
    </CSQ>
</prefs>

 

This one succeeds and sets the opt_ManualCloseCSD to true:

"/descendant::prefs/child::CSQ[@ID=12345]/child::opt_ManualCloseCSD"

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

<prefs>
    <CSQ ID="12345">
        <opt_ManualCloseCSD>true</opt_ManualCloseCSD>

    </CSQ>

    <CSQ ID="SAS">
        <opt_ManualCloseCSD>false</opt_ManualCloseCSD>
    </CSQ>
</prefs>

 

Any assistance appreciated.

 

Brian

  • Contact Center
1 ACCEPTED SOLUTION

Accepted Solutions

[@ID='" + var_CSQ + "']Notice

[@ID='" + var_CSQ + "']

Notice the Single Quote right next to the Double Quote before the Variable and after the Variable..it's really:

String s1 = "/descendendant::prefs/child::CSQ[@ID='";

String s2 = "']/child::opt_ManualCloseCSD";

String s3 = s1+var_CSQ+s2;

7 REPLIES

Wrap All of them in Single

Wrap All of them in Single Quotes: @ID='CustomerService' (even the "numerics" even though they work in XPath without them)..

New Member

That worked, thanks Sam. So

That worked, thanks Sam.

 

So how do I include the variable in the Get XML step?

Here's the static value:

"/descendant::prefs/child::CSQ[@ID='CustomerService']/child::opt_ManualCloseCSD" 

 

My attempts to use this fail:

"/descendant::prefs/child::CSQ[@ID=" + var_CSQ + "]/child::opt_ManualCloseCSD" 

 

 

New Member

By the way, I also tried this

By the way, I also tried this variant which includes the double-then-single quote marks recommendation from Dr. VoIP's but no luck.

 

"/descendant::prefs/child::CSQ[@ID="' + var_CSQ + '"]/child::opt_ManualCloseCSD" 

 

The error I receive when I attempt to save the edit is "Unable to parse expression; un-terminated character: ' (line: 1, col: 37)."

 

this ' needs to be part of

this ' needs to be part of the String (in the case where you are getting a bad expression UNTERMINATED..Terminated means this: "'"

New Member

Actually this worked perfect:

Actually this worked perfect:

 

"/descendant::prefs/child::CSQ[@ID='" + var_CSQ + "']/child::opt_ManualCloseCSD"

 

I do not use variables for the prefix/suffix of the XPath ... just for the CSQ.

 

So it turns out I just had the quotes reversed.

 

Regardless, thanks Sam!

 

New Member

Ah, ok. I see the difference.

Ah, ok. I see the difference. You have single-then-double, NOT double-then-single. Okay ... trying that out. Will report back.  Thanks!

[@ID='" + var_CSQ + "']Notice

[@ID='" + var_CSQ + "']

Notice the Single Quote right next to the Double Quote before the Variable and after the Variable..it's really:

String s1 = "/descendendant::prefs/child::CSQ[@ID='";

String s2 = "']/child::opt_ManualCloseCSD";

String s3 = s1+var_CSQ+s2;

55
Views
10
Helpful
7
Replies
This widget could not be displayed.