according this answer:
html 4.01 specifies <a> elements may contain inline elements. <div> block element, may not appear inside <a>.
but...
html5 allows <a> elements contain blocks.
well, tried selecting <div class="m"> within <a> block, using:
elements elems = a.select("m"); and elmes returns empty, despite div being there.
so thinking: either not using correct syntax selecting div within or... jsoup doesn't support html5-only feature?
what right jsoup syntax selecting div within a?
update: tried
elements elems = a.getelementsbyclass("m"); and jsoup had no problems (i.e. returns correct number of such divs within a).
so question is: why?
why a.getelementsbyclass("m") work whereas a.select("m") doesn't?
update: tried, per @delan azabani's suggestion:
elements elems = a.select(".m"); and worked. a.select() works missing . in front of class name.
the select function takes selector. if pass 'm' argument, it'll try find m elements children of a element. need pass '.m' argument, find elements m class under a element.
Comments
Post a Comment