> How do I use parsing to pull out a specific field from a string in java?

How do I use parsing to pull out a specific field from a string in java?

Posted at: 2014-12-18 
Here is my code. When I run it right now it displays . But I only want to display the actual temperature(83). How would I use parsing to do this?

import java.io.*;

import java.net.*;

import javax.swing.text.html.parser.Parser;

public class TCP_HTTP {

public static void main(String[] args) throws Exception, IOException

{

// TODO Auto-generated method stub

String FromServer;

Socket clientSocket = new Socket("weather.yahooapis.com", 80);



PrintWriter outToServer = new PrintWriter(

clientSocket.getOutputStream(),true);

outToServer.println("GET http://weather.yahooapis.com/forecastrss?w=2449323");

BufferedReader inFromServer = new BufferedReader(

new InputStreamReader(clientSocket.getInputStream()));



Thread.sleep(1000);

while ((FromServer = inFromServer.readLine())!=null)

{

String temperature = FromServer.toString();

if(FromServer.indexOf("yweather:condition")== 1)

{

//FromServer.contentEquals("yweather:condition");

System.out.println(temperature);

}

// System.out.println("Received:" + FromServer.indexOf("yweather:condition"));

}

clientSocket.close();

}

}