Skip to main content
Solved

CSS Selcetors in HTML Extractor


ajbaum77
Contributor
Forum|alt.badge.img+11

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

Best answer by takashi

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

View original
Did this help you find an answer to your question?

3 replies

danilo_fme
Evangelist
Forum|alt.badge.img+41
  • Evangelist
  • May 25, 2018

Hi @ajbaum77

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

Thanks,

Danilo


takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • Best Answer
  • May 25, 2018

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


ajbaum77
Contributor
Forum|alt.badge.img+11
  • Author
  • Contributor
  • May 29, 2018
takashi wrote:

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 '+'.

 

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings