How to do Parsing in j2me(java)

痴心易碎 提交于 2019-12-24 15:06:53

问题


i want to extract the

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"

allowfullscreen/iframe

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


回答1:


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


来源:https://stackoverflow.com/questions/11626040/how-to-do-parsing-in-j2mejava

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