2
To create a java desktop application that accesses the internet and le an xml file. Well, this is the initial proprosito. I am using the Socket class to communicate between the server and the application. But now I don’t know how to read the xml. I changed my code, no while I plan to save the XML. Still searching as.
public static void main(String[] args) throws IOException
{
try
{
//conectando
URL url = new URL("http://www.cinemark.com.br/mobile/xml/films/");
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
//pegando informações
BufferedReader leitor = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
String line;
FileWriter arquivo = new FileWriter("D:\\Documentos\\GitHub\\arquivo.txt");
PrintWriter gravArq = new PrintWriter(arquivo);
while ((line = leitor.readLine()) != null)
{
gravArq = gravArq.printf(line);
}
leitor.close();
urlConnection.disconnect();
}
catch (MalformedURLException ex) { System.out.println("Erro ao criar url: formato invalido"); }
}
Thanks for the help. I will read the documentation and the files I have on SAX and Dom on the way home. VLW same
– Rafael Camillo