Solved

CSS Selcetors in HTML Extractor


Badge +1

Hi all,

Working to parse some sections out of a webpage. I need to associate some values with their heading. I can get the h3 values I need or all the ul or li elements on the page but trying to get just the ul and li element under each h3 to keep them grouped. Seems like using a h3 ul li selector should work but it doesn't return anything. Changing the space to a comma (,) returns all the values not just those ul and li within the h3. I've also gotten the values for the h3 and can get each h3 individually using "h3:nth-of-type(@Value(part_idGEN))" but again trying to get the ul or li element under this doesn't work either.

Using FME2018.0.0.1 Build 18295

Webpage is https://www.thewindpower.net/windfarm_en_182_gent-zeehaven.php

 

Thanks,

Andrew

icon

Best answer by takashi 25 May 2018, 04:27

View original

3 replies

Userlevel 4
Badge +30

Hi @ajbaum77

Are you using the transformer Creator and after the transformer HTTPCaller?

Thanks,

Danilo

Userlevel 2
Badge +17

Hi @ajbaum77, I think the result you have gotten is correct since your required <ul> element is a sibling following to an <h3> element, is not inside of <h3>. If you need to extract the value of <h3> element and whole content of the following <ul> element, for example, a possible setting is:

Note that a space is required before and after the '+' in the second CSS Selector.

See here to learn more about CSS Selectors: CSS Selector Reference

Badge +1

Hi @ajbaum77, I think the result you have gotten is correct since your required <ul> element is a sibling following to an <h3> element, is not inside of <h3>. If you need to extract the value of <h3> element and whole content of the following <ul> element, for example, a possible setting is:

Note that a space is required before and after the '+' in the second CSS Selector.

See here to learn more about CSS Selectors: CSS Selector Reference

Thanks this is exactly what I needed. I had tried something similar but think I missed the spaces around the '+'.

 

 

Reply