Galera queria pegar os dados sobre previsão de tempo de um site [url]http://www.webservicex.com/globalweather.asmx/GetWeather?CityName=Sao%20Paulo&CountryName=Brazil[/url]
O resultado no browser é o seguinte :
public static Document getDocument( DocumentBuilder db, String urlString ) {
try {
URL url = new URL( urlString );
try {
URLConnection URLconnection = url.openConnection( ) ;
HttpURLConnection httpConnection = (HttpURLConnection) URLconnection;
int responseCode = httpConnection.getResponseCode( ) ;
if ( responseCode == HttpURLConnection.HTTP_OK) {
InputStream in = httpConnection.getInputStream( ) ;
try {
Document doc = db.parse( in );
return doc;
} catch(org.xml.sax.SAXException e ) {
e.printStackTrace( ) ;
}
} else {
System.out.println( "HTTP connection response != HTTP_OK" );
}
} catch ( IOException e ) {
e.printStackTrace( ) ;
} // Catch
} catch ( MalformedURLException e ) {
e.printStackTrace( ) ;
} // Catch
return null;
} // getDocument
e o que tenho de retorno não e no mesmo, ele vem de outra maneira...
Eu queria estar manipulando isso de modo que eu tivesse a saída assim
Sao Paulo/Congonhas Aeroporto, Brazil (SBSP) 23-37S 046-39W 802M
Jan 18, 2008 - 02:00 PM EST / 2008.01.18 1900 UTC
from the NNW (340 degrees) at 15 MPH (13 KT):0 Wind;
greater than 7 mile(s):0
mostly cloudy
78 F (26 C)
66 F (19 C)
65%
29.91 in. Hg (1013 hPa)
Ou talvez a questão seja como eu manipulo XML a partir de um URL http://www.webservicex.com/globalweather.asmx/GetWeather?CityName=Sao%20Paulo&CountryName=Brazil
Valeu