how to parse xml output and get value of an element/sub-element under a specific tag in robot framework
<p>I'm trying to parse the following xml output and get the element and sub-element for the tags using robot framework. I want to get a specific value for example "adjacency-state" for level 2. Since there are multiple identical tags, how can i achieve that. </p>

<p>Example:</p>

<pre><code>&lt;isis-adjacency-information&gt;
&lt;isis-adjacency&gt;
    &lt;interface-name&gt;xe-0/0/2:0.0&lt;/interface-name&gt;
    &lt;system-name&gt;st-48s-p2-31&lt;/system-name&gt;
    &lt;level&gt;1&lt;/level&gt;
    &lt;adjacency-state&gt;Up&lt;/adjacency-state&gt;
    &lt;holdtime&gt;8&lt;/holdtime&gt;
    &lt;snpa&gt;88:e0:f3:1c:a0:7&lt;/snpa&gt;
&lt;/isis-adjacency&gt;
&lt;isis-adjacency&gt;
    &lt;interface-name&gt;xe-0/0/2:0.0&lt;/interface-name&gt;
    &lt;system-name&gt;st-48s-p2-31&lt;/system-name&gt;
    &lt;level&gt;2&lt;/level&gt;
    &lt;adjacency-state&gt;Up&lt;/adjacency-state&gt;
    &lt;holdtime&gt;6&lt;/holdtime&gt;
    &lt;snpa&gt;88:e0:f3:1c:a0:7&lt;/snpa&gt;
&lt;/isis-adjacency&gt;
&lt;/isis-adjacency-information&gt;
</code></pre>

<p>Below code fetches the value for the first xpath match. But I need the adjacency state under level 2. </p>

<pre><code>${cmd0}=    Execute    Commands Executor    @{target}[0]    command=show isis adjacency    format=xml    xpath=//adjacency-state
</code></pre>

<p>Any suggestions/ideas are welcome.
Thanks,</p>