how to parse the image from url SAX parsing

一个人想着一个人 提交于 2019-12-11 14:34:22

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!