使用NSURLconnection发送请求时返回的数据包含这样的脚本
<script>
var baseURL = "main.aspx?";
var lang = 1;
lg(0,8375,"AFC U-22 Championship Qualifirs","http://images.goalzz.com/i.aspx?i=competitions%2fafc_small_icon.gif");
mc(0,752017,1,"","11:45®<br><nobr> <font color=yellow>playing",1298,"","Malaysia","","",2163,"","Myanmar","","<font color=#427384>Week: 5<br>","",0);
mc(0,752021,2,"","12:00®<br><nobr> <font color=yellow>playing",7849,"","Laos","","",2158,"","Cambodia","","<font color=#427384>Week: 5<br>","",0);
mc(0,752022,3,"","12:00®<br><nobr> <font color=yellow>playing",479,"","Bahrain","","",1574,"","Iran","","<font color=#427384>Week: 5<br>","",0);
lg(6,8048,"Wimbledon - Men","http://images.goalzz.com/i.aspx?i=tennis%2ftennis_small.gif");
mc(6,754074,4,"","10:30®<br><nobr><font color=yellow>2nd Set",274,"","Brian Baker - <font size=-1 color=black>United States</font>","","<font color=blue>1 : 1</font>",110,"","<font size=-1 color=orange>(27) </font>Philipp Kohlschreiber - <font size=-1 color=black>Germany</font>","","<font color=red>Round 4<br>","",0);
mc(6,754076,5,"","10:30®<br><nobr><font color=yellow>2nd Set",342,"","<font size=-1 color=orange>(5) </font>Jo-Wilfried Tsonga - <font size=-1 color=black>France</font>","","<font color=blue>0 : 1</font>",282,"","<font size=-1 color=orange>(10) </font>Mardy Fish - <font size=-1 color=black>United States</font>","","<font color=red>Round 4<br>","",0);
mc(6,753844,6,"","10:30®<br><nobr><font color=yellow>3rd Set",5,"","<font size=-1 color=orange>(18) </font>Richard Gasquet - <font size=-1 color=black>France</font>","","<font color=blue>1 : 2</font>",86,"","<font size=-1 color=orange>(31) </font>Florian Mayer - <font size=-1 color=black>Germany</font>","","<font color=red>Round 4<br>","",0);
mc(6,754075,7,"","11:00®<br><nobr><font color=yellow>2nd Set",107,"","<font size=-1 color=orange>(7) </font>David Ferrer - <font size=-1 color=black>Spain</font>","","<font color=blue>1 : 1</font>",669,"","<font size=-1 color=orange>(9) </font>Juan Martin Del Potro - <font size=-1 color=black>Argentina</font>","","<font color=red>Round 4<br>","",0);
mc(6,754092,8,"","11:00®<br><nobr><font color=yellow>3rd Set",675,"","<font size=-1 color=orange>(16) </font>Marin Cilic - <font size=-1 color=black>Croatia</font>","","<font color=blue>0 : 2</font>",16,"","<font size=-1 color=orange>(4) </font>Andy Murray - <font size=-1 color=black>United Kingdom</font>","","<font color=red>Round 4<br>","",0);
</script>
我想在lg节点和(马来西亚,缅甸)的mc节点中提取(AFC U-22锦标赛资格赛)文本。这可能吗?
答案 0 :(得分:0)
你必须做一些字符串操作和搜索
例如,你可以搜索锦标赛(锦标赛冠军,“)和第一次出现之间的字符串;);
对于马来西亚和缅甸使用类似的搜索方法,没有内置函数可以解析这种字符串
如果您可以控制此请求,请考虑使用JSON或XML作为远程数据
答案 1 :(得分:0)
你需要在此进行字符串搜索。这个link将帮助你实现这一目标。您可以按照以下步骤操作。
现在你可以得到两个字符串。
祝你好运