通过SAXParser的解析XML包含HTML标签 [英] parsing xml via SAXParser contain html tag

查看:323
本文介绍了通过SAXParser的解析XML包含HTML标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从XML包含HTML标记解析数据。
我不能够获得图像src属性任何一个可以显示出此链接。
http://mobileecommerce.site247365.com/admin/catdata.xml
我给你网址,却也并不意味着我想显示整个code由你。我的意思是给出一些链接或一些了解。

在此先感谢

Arpit


解决方案

 字符串str =你的Cat_Desc标签值;
    的String []温度;        如果(str.contains(&下; IMG SRC =)){
                                临时= str.split(&下; IMG SRC =);
                                字符串imagesUrl =气温[1] .substring(
                                温度[1] .indexOf(\\),临时[1]
                                                。指数( ));
                                imagesUrl = imagesUrl
                                    .replace(\\,);
                                的System.out.println(我的图片网址::+ imagesUrl);
                                }其他{
                              的System.out.println(NO图片网址找到); }

I have parse data from xml that contain html tag. i am not able to get image src attribute can any one show this link. http://mobileecommerce.site247365.com/admin/catdata.xml i give you url it's not mean that i want to show whole code from you.i mean give some links or some idea for that.

Thanks in advance

Arpit

解决方案

    String str = "Your Cat_Desc tag value";
    String[] temp;

        if (str.contains("<img src=")) {
                                temp = str.split("<img src=");
                                String imagesUrl = temp[1].substring(
                                temp[1].indexOf("\""), temp[1]
                                                .indexOf(" "));
                                imagesUrl = imagesUrl
                                    .replace("\"", " ");
                                System.out.println("My image URL :: " +imagesUrl);
                                }else    {
                              System.out.println("NO imageurl found");           }

这篇关于通过SAXParser的解析XML包含HTML标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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