• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Jsoup Parsing

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm currently using jsoup to parse a HTML document. I've loaded it into a Document by using



This in itself returns three elements in the ele list
<li class="second-col"> <label for="ctl00_Content_ctl00_ddlAirline" id="ctl00_Content_ctl00_lblAirline">Airline</label> <select name="ctl00$Content$ctl00$ddlAirline" id="ctl00_Content_ctl00_ddlAirline"> <option selected="selected" value="">Any</option> <option value=""></option> <option value="Aer Lingus">Aer Lingus</option> <option value="Air Canada Aca">Air Canada Aca</option>...............

and so on.

I'm looking to select the first element of the list, and parse the <option value> into an ArrayList<String>.

Anyone know how I can do this?
 
Greenhorn
Posts: 20
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Brian McGowan wrote:I'm currently using jsoup to parse a HTML document. I've loaded it into a Document by using



This in itself returns three elements in the ele list
<li class="second-col"> <label for="ctl00_Content_ctl00_ddlAirline" id="ctl00_Content_ctl00_lblAirline">Airline</label> <select name="ctl00$Content$ctl00$ddlAirline" id="ctl00_Content_ctl00_ddlAirline"> <option selected="selected" value="">Any</option> <option value=""></option> <option value="Aer Lingus">Aer Lingus</option> <option value="Air Canada Aca">Air Canada Aca</option>...............

and so on.

I'm looking to select the first element of the list, and parse the <option value> into an ArrayList<String>.

Anyone know how I can do this?



You need something like this?

Look at jsoup manual, maybe you can find something.
http://jsoup.org/cookbook/extracting-data/attributes-text-html
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic