Agustin Scalisi
Agustin Scalisi

Reputation: 551

Jsoup returning empty elements

I am parsing this page: http://www.catedralaltapatagonia.com/invierno/partediario.php

This is the page source code

 <!-- COMIENZO PESTAÑA METEOROLOGIA -->
<div class="TabbedPanelsContent">
<div class="contenedor">
  <div id="pd_foto_fondo">
<br />
<div id="meteo_contenedor_avalanchas">&nbsp;&nbsp;&nbsp; ULTIMA ACTUALIZACION PARTE DIARIO:     FECHA: 03 de Junio de 2015  HORA: 09:00 hs</div>
  <br />......

and this is the code i use to get the data

 Document document = Jsoup.connect(url).get();
            Elements div = document.select("div#meteo_contenedor_avalanchas");
 TextView textview= (TextView) findViewById(R.id.sometextview);
        textview.setText(Html.fromHtml(div));

But I receive an empty result.

I need ths text: ULTIMA ACTUALIZACION PARTE DIARIO: FECHA: 03 de Junio de 2015 HORA: 09:00 hs

how fix it?

Upvotes: 0

Views: 1044

Answers (1)

Ankii Rawat
Ankii Rawat

Reputation: 2090

In place of

Elements div = document.select("div#meteo_contenedor_avalanchas");

Add below code,

String div = document.getElementById("meteo_contenedor_avalanchas").toString();

Upvotes: 1

Related Questions