1_
12 years agoOccasional Contributor
[Resolved] Struggling with selecting an xpath node
Hi, everyone!
I searched the forums but couldn't quite find what I was looking for here, in the SoapUI docs, or W3Schools tutorials. I'm sure I'm missing something fairly obvious.
I'm trying to select all of the second e node with all of its descendants. Here is the XML response I'm working with:
I thought, based on my reading on the SoapUI docs(http://www.soapui.org/Functional-Testin ... alues.html) and W3Schools(http://www.w3schools.com/xpath/xpath_syntax.asp), that this would work:
But I'm getting a "No match in the current response" error. I do get the full response when I specify //GetFormQs:candidate_questions, but I'd like to drill down and get a little more specific.
Any ideas what I'm doing wrong, and how to do it right?
-E
I searched the forums but couldn't quite find what I was looking for here, in the SoapUI docs, or W3Schools tutorials. I'm sure I'm missing something fairly obvious.

I'm trying to select all of the second e node with all of its descendants. Here is the XML response I'm working with:
<Response xmlns="https://api.foo.com/v2.1/Candidates/Forms/Questions/">
<candidate_questions>
<e>
<admin>N</admin>
<answer_type>--</answer_type>
<candidate_options/>
<app_field>N</app_field>
<is_required>N</is_required>
<position>1</position>
<question>Privacy Statement</question>
<question_forms/>
<question_id>603</question_id>
<question_type>--</question_type>
</e>
<e>
<admin>Y</admin>
<answer_type>D8</answer_type>
<candidate_options/>
<app_field>N</app_field>
<is_required>N</is_required>
<position>2</position>
<question>Date</question>
<question_forms>
<e>
<id>1</id>
<position>10</position>
<required>N</required>
</e>
<e>
<id>60</id>
<position>9</position>
<required>Y</required>
</e>
<e>
<id>62</id>
<position>4</position>
<required>N</required>
</e>
</question_forms>
<question_id>782</question_id>
<question_type>A</question_type>
</e>
<e>
<admin>N</admin>
<answer_type>B</answer_type>
<candidate_options>
<e>
<answer>Yes</answer>
<answer_id>2127</answer_id>
<position>1</position>
</e>
</candidate_options>
<app_field>N</app_field>
<is_required>N</is_required>
<position>4</position>
<question>Checked In</question>
<question_forms/>
<question_id>203</question_id>
<question_type>D</question_type>
</e>
I thought, based on my reading on the SoapUI docs(http://www.soapui.org/Functional-Testin ... alues.html) and W3Schools(http://www.w3schools.com/xpath/xpath_syntax.asp), that this would work:
declare namespace GetFormQs='https://api.foo.com/v2.1/Candidates/Forms/Questions/';
//GetFormQs:candidate_questions/e[2]
But I'm getting a "No match in the current response" error. I do get the full response when I specify //GetFormQs:candidate_questions, but I'd like to drill down and get a little more specific.
Any ideas what I'm doing wrong, and how to do it right?
-E