cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
440
Views
10
Helpful
7
Replies

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

1 Accepted Solution

Accepted Solutions

[@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;

View solution in original post

7 Replies 7

Samuel Womack
Level 5
Level 5

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

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" 

 

 

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 the String (in the case where you are getting a bad expression UNTERMINATED..Terminated means this: "'"

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!

 

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