如何从url SAX解析中解析图像 [英] how to parse the image from url SAX parsing

查看:98
本文介绍了如何从url SAX解析中解析图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何从xml文件url里面的链接解析图像。当我解析数据时,它显示了除了显示图像之外的链接。这里是图像的链接 http://www.worldweatheronline.com/images/wsymbols01_png_64/wsymbol_0001_sunny .png

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

和链接i解析数据来自

http://free.worldweatheronline.com/feed /weather.ashx?q=peshawar,pakistan&format=xml&num_of_days=5&key=eab9f57359164426132301

推荐答案

以下是从网址制作缓冲图片的代码。

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();
    }

这篇关于如何从url SAX解析中解析图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆