I’m trying to learn xpath by writing a simple program that will list the fixtures of Premier League in footbal from the following page:
http://www.livefootball.com/football/england/premier-league/
I’ve already collected all the dates using the //dl[@class='mElHeaderDet'] statement and all the general match details using //div[@class='mEl show']/dl/*. The problem is however, it seems that every match in that page has it’s own unique ID, for example the first match goes like this:
<dl id="fid1-1228229" class="even">
<dd class="mElStatus">16:00</dd>
<dd class="mElO1">Arsenal</dd>
<dd class="mElScore">v</dd>
<dd class="mElO2">Sunderland</dd>
</dl>
in this example the fid1-1228229 is what interests me. How would I approach getting a list of all the matches’ IDs?
Thanks
To retrieve list of all ids you can use
Above Xpath will return you list of values of
idattribute for divs whose class is notmElHeaderDet.OR
Alternatively you can use this xpath as well
Above XPath will return you list of ids of all the divs whose ID attribute value starts with
fidHope this helps.