如何在j2me(java)中进行解析 [英] How to do Parsing in j2me(java)

查看:105
本文介绍了如何在j2me(java)中进行解析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要提取

iframe广告代码"src"值 http://www.teluguone.com/videos/single/comedy/Comedy-Express-464---背对背--- Comedy-Scenes-14727.html

iframe tag "src" value from the below url http://www.teluguone.com/videos/single/comedy/Comedy-Express-464---Back-to-Back---Comedy-Scenes-14727.html

iframe width ="640" height ="380" src ="http://www.youtube.com/embed/XJDw2T1nGJQ" frameborder ="0"

iframe width="640" height="380" src="http://www.youtube.com/embed/XJDw2T1nGJQ"frameborder="0"

allowfullscreen/iframe

allowfullscreen/iframe

我如何在j2me中实现它?htmlparser,Jericho,Jsoup解析器在j2me中不受支持

How can i achieve it in j2me?htmlparser ,Jericho ,Jsoup parser are not supported in j2me

推荐答案

假定您已经将html源存储在名为htmlPage的String变量中.

Assuming you already have the html source stored in a String variable called htmlPage.

int iFrameIndex = htmlPage.indexOf("iframe");
int srcIndex = htmlPage.indexOf("src", iFrameIndex);
int httpIndex = htmlPage.indexOf("http", srcIndex);
int quotesIndex = htmlPage.indexOf("\"", httpIndex);
String srcUrl = htmlPage.substring(httpIndex, quotesIndex);

这篇关于如何在j2me(java)中进行解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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