How to use JsonXPathExtractionStrategy #1639
Unanswered
chunyuliu106667777
asked this question in
Forums - Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
<html> <body> <div class="TwoColumnLayout-Head"> <div class="ArticleBase-Header ArticleBase-HeaderLayout"> <ul class="ArticleBase-Topics" data-testid="article-topics"> <li class="ArticleBase-Topic"><a data-component="keyword" class="Keyword Keyword_variant_category Keyword_title_vulnerabilitiesThreats" href="/vulnerabilities-threats" data-discover="true">Vulnerabilities & Threats</a></li> <li class="ArticleBase-Topic"><a data-component="keyword" class="Keyword Keyword_variant_category Keyword_title_endpointSecurity" href="/endpoint-security" data-discover="true">Endpoint Security</a></li> <li class="ArticleBase-Topic"><a data-component="keyword" class="Keyword Keyword_variant_category Keyword_title_threatIntelligence" href="/threat-intelligence" data-discover="true">Threat Intelligence</a></li> <li class="ArticleBase-Topic"><a data-component="keyword" class="Keyword Keyword_variant_category Keyword_title_mobileSecurity" href="/endpoint-security/mobile-security" data-discover="true">Mobile Security</a></li> <li class="ArticleBase-Topic"><a data-component="keyword" class="Keyword Keyword_variant_category Keyword_title_news" href="/latest-news" data-discover="true">News</a></li> </ul> </div> </div> </body> </html>I'm trying to parse fields from a portion of a page using JsonXPathExtractionStrategy. I want to parse all the
<a>tags under the<li>tags in the HTML code above and generate the final result with the structure shown below. How should I do this?"tags": [ {"text": "Vulnerabilities & Threats", "href": "/vulnerabilities-threats"}, {"text": "Endpoint Security", "href": "/endpoint-security"}, {"text": "Threat Intelligence", "href": "/threat-intelligence"}, {"text": "Mobile Security", "href": "/endpoint-security/mobile-security"}, {"text": "News", "href": "/latest-news"} ]Beta Was this translation helpful? Give feedback.
All reactions