您的位置:首页 > 其它

获取xml中标签属性值

2017-05-23 11:40 120 查看
public static String replaceAHref(String xml){

  

        String retxml =null;

        //<a href="http://www.example.com/index.htm"></a>

        Document doc = Jsoup.parse(xml);

        Elements elments = doc.getElementsByTag("a");

        for(Element e:elments){

                String href = e.attr("href");

                if(href.startsWith("/")){

                        e.attr("href",URI+href);

                }

         }

        retxml = doc.toString();

        elments=null;

        doc=null;

  

        return retxml;

 }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: