Is There any way use Xpath value query with string manupilation?

Hello everyone,
I’m trying to getting some data from one of website. Xml going like this:
/html/body/div[4]/div[4]/div[3]/div[5]/div[2]/div[5]/div[2]/div[3]/div/div[2]/div[2]/div[1]/a
/html/body/div[4]/div[4]/div[3]/div[5]/div[2]/div[5]/div[2]/div[6]/div/div[2]/div[2]/div[1]/a
/html/body/div[4]/div[4]/div[3]/div[5]/div[2]/div[5]/div[2]/div[9]/div/div[2]/div[2]/div[1]/a

So I’m curious maybe there is a way to use xpath with string manupilation.
Is there any example workflow?

Thank you in advance,
Regards,
İdris

Hi,

Why don’t you just get all the elements and then filter them by the row IDs?
For example, in the Xpath node you can select the “Multiple Rows” option and apply this path:
/dns:html/dns:body/dns:div[4]/dns:div[4]/dns:div[3]/dns:div[5]/dns:div[2]/dns:div[5]/dns:div[2]/dns:div/dns:div/dns:div[2]/dns:div[2]/dns:div[1]/dns:a
As you can see I have removed the counter for the bolded div element so all the elements in the list will be collected. After getting them all you can filter the rows easily.

Best,
Armin

P.S. This short tutorial may help you as well:
https://blog.statinfer.com/how-to-get-the-content-of-a-web-page-in-knime/

2 Likes

Thank you so much. Now it’s working!

2 Likes

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