xpath node cell multiple tag selection

I was trying to get list of xml strings with parent-child relation. Then i realized xpath node does not relate any two selection. After a little research, i discoverd “node cell” option to slice the whole xml codes into desired family(parent+child) parts. But i couldnt achived that either. because xpath node does not allow me to select multiple tags at same time. for demonstration my code is like that;

.
.
.
<h5>
 <u>A</u>
</h5>
<ul class="listss">
<li>
<h5>
<a href="link">
 linktext
</a>
</h5>
</li>
<li>
<h5>
<a href="link2">
 linktext2
</a>
</h5>
</li>
</ul>


<h5>
 <u>B</u>
</h5>
<ul class="listss">
 .\
 .(SAME TAGS AS ABOVE)
 ./
</ul>


<h5>
 <u>C</u>
</h5>
<ul class="listss">
 .\
 .(SAME TAGS AS ABOVE)
 ./
</ul>


<h5>
 <u>D</u>
</h5>
<ul class="listss">
 .\
 .(SAME TAGS AS ABOVE)
 ./
</ul>
.
.
.

I just want first h5 and ul tags together like this;
.
.
.
<h5>
 <u>A</u>
</h5>
<ul class="listss">
<li>
<h5>
<a href="link">
 linktext
</a>
</h5>
</li>
<li>
<h5>
<a href="link2">
 linktext2
</a>
</h5>
</li>
</ul>

How could it possible.

Hi,
you can select multiple elements at the same time. What is your desired outcome table for the XPath node, exactly?
Kind regards
Alexander

1 Like

between first “h5” and first “/ul”

Hi @tlhztrk,

here we go. Please note that w/o fully understanding how you retrieve the html I assume it’s just a local file.

The tricky part is understanding what XPath 1.0 is capable of in combination with what / how Knime works with the data. Hope it helps …

Merry Christmas
Mike

4 Likes

Thanks for the solution. This is how i exactly solved my problem before you post it. I think because of “node cell” selection option is not part of xpath’s itself, subsequent or multiple tag selection does not works as I thought.

Is there any alternative xpath selection code to make parent-child relation betwenn selections easily?

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.