in src/main/scala/pa/Parser.scala [128:150]
def parseMatchStats(s: String): Seq[MatchStats] = {
def parseTeam(team: NodeSeq) = {
TeamStats(
team \ "bookings" \@ "total" toInt,
team \ "dismissals" \@ "total" toInt,
team \ "corners" \@ "total" toInt,
team \ "offsides" \@ "total" toInt,
team \ "fouls" \@ "total" toInt,
team \ "shotsOnTarget" \@ "total" toInt,
team \ "shotsOffTarget" \@ "total" toInt
)
}
(XML.loadString(s) \\ "stat").map{ stats =>
MatchStats(
stats \@ "interval" toInt,
stats \> "possession" toInt,
parseTeam(stats \ "homeTeam"),
parseTeam(stats \ "awayTeam")
)
}
}