It's all about the answers!

Ask a question

HTTP Filtered Value Set, xpath, attribute with space

Durand Guillaume (634) | asked Nov 25 '14, 5:55 a.m.
I use //node1/node2[contains(./node3,'${my_attribute_ID.value}')] but if the attribute contains space. The node not find.

How to obtain the node that corresponds to the attribute with space?


4 answers

permanent link
Donald Nong (14.5k414) | answered Nov 25 '14, 9:14 p.m.
Which version of RTC are you using? There is a known defect about white space in XPath.
This is mentioned in the article
Based on the comments in both the work item and the article. It appears that people are still having problems with the white space. I suggest you open a ticket and present your case for a thorough investigation.

permanent link
Brian Fleming (1.6k11928) | answered Nov 25 '14, 10:15 a.m.
Are you sure you're using the attribute ID and not the attribute name in your xpath expression?  If you are sure, how did you create an attribute id with a space in it?  Both the Eclipse and Web UIs prevent this.

Durand Guillaume commented Nov 25 '14, 2:14 p.m.

 Yes I use the attribute ID. I don't have create a attribute ID with a space.

I have a resultat if the value of attribute don't  have a space BUT I don't have a resultat if the value of attribute have a space.

So, ${my_attribute_ID.value} recove the value of attribute but not the space.

Value field
dog cat    :     no resultat (because space)
fish           :    resultat ok


Eric Jodet commented Nov 26 '14, 4:00 a.m.

 Bonjour Guillaume,

which version of RTC are you using?


permanent link
Roberto Marcon (111) | answered Apr 11 '17, 7:09 a.m.
edited Apr 11 '17, 10:26 a.m.

I've a similar problem (RTC v.5.02) and I tried all xpath possibilities to bypass the problem without any result. So, I have:

  1. An enumerator defined as follow:
Name: Corporation
Enumeration Literals:
Name Space
Name Space1
Name Space2

2. An HTTP Filtered Value Set as follow

XML Data Source: https://localhost:9443/Data/ufficio_richiedente.xml
Row XPath Expression: /xml/node[contains(./nomeBanca, "${it.gvb.customattribute.corporation.label}")]/ufficio
Column XPath expression: ./nomeBanca
Entry label format: ${0}

Apply filter string to values received from datasource = CHECKED
Ignore invalid SSL certificates = CHECKED

3. Ufficio_richiedente.xml as follow:

       <?xml version="1.0" encoding="UTF-8"?>
         <node> <nomeBanca>Name</nomeBanca>
    <ufficio>6 - 0303 - NEW</ufficio>
    <nomeBanca>Name Space</nomeBanca>
    <ufficio>9 - 1147 - NEW</ufficio>
    <nomeBanca>Name Space1</nomeBanca>
    <ufficio>3 - 1117 - NEW</ufficio>

When ${it.gvb.customattribute.corporation.label} input is “Name” the xpath match, instead when the input is “Name Space” or “Name Space1” there is no match and the dropdown shows loading label.

I also tried with:

  1. Xpath tester --> it works properly
  2. Using fixed value instead the variable, like /xml/node[contains(./nomeBanca, "Name Space")]/ufficio  --> it works properly

Any idea? 

thanks Rob

permanent link
Roberto Marcon (111) | answered Apr 21 '17, 3:01 a.m.

 In target match user %20 as space. So, you will have:

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

Your answer

Register or to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.