Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
分析特定类的html表行_Html_Swift_Swiftsoup - Fatal编程技术网

分析特定类的html表行

分析特定类的html表行,html,swift,swiftsoup,Html,Swift,Swiftsoup,我正在使用swiftSoup成功地从表行获取值,但我希望仅从类为“rowdata_cxl”的表字段获取数据,而不希望从类为“rowdata_normal”的表字段获取数据(请参见下面的HTML) <tr onmouseover="currentbgcolor=this.style.backgroundColor;this.style.backgroundColor='#FFF0BA'" onmouseout="this.style.backgroundCol

我正在使用swiftSoup成功地从表行获取值,但我希望仅从类为“rowdata_cxl”的表字段获取数据,而不希望从类为“rowdata_normal”的表字段获取数据(请参见下面的HTML)

 <tr onmouseover="currentbgcolor=this.style.backgroundColor;this.style.backgroundColor='#FFF0BA'" onmouseout="this.style.backgroundColor=currentbgcolor;">
                                    <td class="rowdata_cxl">005</td>
                                    <td class="rowdata_cxl" onclick="GetAcPlan('500047','',this)" style="cursor: pointer; text-decoration: underline"></td>
                                    <td class="rowdata_cxl">PEK</td>
                                    <td class="rowdata_cxl">1220</td>
                                    <td class="rowdata_cxl">1605</td>
                                    <td class="rowdata_cxl"></td>
                                    <td class="rowdata_cxl"></td>
                                    <td class="rowdata_cxl"></td>
                                    <td class="rowdata_cxl"></td>
                                    <td class="rowdata_cxl"></td>
                                    <td class="rowdata_cxl"></td>
                                    <td class="rowdata_cxl"><span title="" class="bkglf_normal" tdata="市场原因(商)">市场原因(... </span></td>
                                    <td class="rowdata_cxl"></td>
                                    <td class="rowdata_line_data"></td>
                                    <td class="rowdata_normal"></td>
                                    <td class="rowdata_normal" onclick="GetAcPlan('','',this)" style="cursor: pointer; text-decoration: underline"></td>
                                    <td class="rowdata_normal"></td>
                                    <td class="rowdata_normal"></td>
                                    <td class="rowdata_normal"></td>
                                    <td class="rowdata_normal"></td>
                                    <td class="rowdata_normal"></td>
                                    <td class="rowdata_normal"></td>
                                    <td class="rowdata_normal"></td>
                                    <td class="rowdata_normal"></td>
                                    <td class="rowdata_normal"></td>
                               </tr>

for item in try! tr.select("td") {
  
 switch counterColonne {
   case 1:
     if try! item.text() != "" {
                                                
      flight.FLTn = try! item.text()
       flight.departure = false // arrival
                                                
     }
 // all case required...up to 25
case 25:
  if try! item.text() != "" {
   flight.dlyrs = try! item.text()
 }
default:
   break
  }                           
  counterColonne += 1
   }