问题
how do i parse the image form the link inside the xml file url.when i parse the data it shows me the link besides showing image. here is the link of image http://www.worldweatheronline.com/images/wsymbols01_png_64/wsymbol_0001_sunny.png
and the link i an parsing data from
http://free.worldweatheronline.com/feed/weather.ashx?q=peshawar,pakistan&format=xml&num_of_days=5&key=eab9f57359164426132301
回答1:
Here is the code to make a buffered image from the url.
try {
URL url = new URL("http://www.worldweatheronline.com/images/wsymbols01_png_64/wsymbol_0001_sunny.png");
BufferedImage bufferedImage = ImageIO.read(url);
ImageIO.write(bufferedImage, "png", new FileOutputStream("/home/visruth/OutputImage.png"));// A file named OutputImage.png will be created in the location /home/visruth/
} catch(Exception e) {
e.printStackTrace();
}
来源:https://stackoverflow.com/questions/14566209/how-to-parse-the-image-from-url-sax-parsing