我正在从 xml 足球馈送器获取 xml 提要,我想从 xml 提要中选择所有 ID 大于我从数据库中的最后一个 id 的值......
我该怎么做?在 .net 中是否有类似 LINQ 的东西,我可以在其中选择一些条件?我知道对于phpLinq,没有任何框架有什么更好的主意吗?
像这样:
$fixtures=
$this->soccer->GetFixturesByDateInterval(
array("startDateString"=>$start,"endDateString"=>$end))->Match->Id->where(Match->Id > $number);
很少有来自没有匹配>ID>等var_dump $fixtures的提要......
object(SimpleXMLElement)[5]
public 'Match' =>
array (size=11)
0 =>
object(SimpleXMLElement)[6]
public 'Id' => string '348257' (length=6)
public 'Date' => string '2015-06-19T00:00:00+00:00' (length=25)
public 'League' => string 'Brasileirao' (length=11)
public 'Round' => string '8' (length=1)
public 'HomeTeam' => string 'Figueirense' (length=11)
public 'HomeTeam_Id' => string '922' (length=3)
public 'AwayTeam' => string 'Internacional' (length=13)
public 'AwayTeam_Id' => string '736' (length=3)
public 'Location' => string 'Orlando Scarpelli' (length=17)
1 =>
object(SimpleXMLElement)[7]
public 'Id' => string '348051' (length=6)
public 'Date' => string '2015-06-18T17:20:00+00:00' (length=25)
public 'League' => string 'Superettan' (length=10)
public 'Round' => string '14' (length=2)
public 'HomeTeam' => string 'Degerfors' (length=9)
public 'HomeTeam_Id' => string '1193' (length=4)
public 'AwayTeam' => string 'Syrianska' (length=9)
public 'AwayTeam_Id' => string '593' (length=3)
public 'Location' => string 'Stora Valla' (length=11)
你应该使用 XPath。例如,如果要选择 ID 属性大于 X 的所有行:
$rows = $xml->xpath("//row[@id>x]");