问题
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