0
通過搜索本網站,我已經能夠獲得主要所有的答案..謝謝!JSoup解析HTML div標記
不幸的是,我遇到了一個絆腳石解析文件與足球統計數據這是竊聽我。下面的div標籤似乎有多個嵌套元素,我只是無法弄清楚如何解析。任何人都可以將我指向正確的方向嗎?
在div id爲player_data,我得到了,我基本上要爲玩家喜歡的數據:
8780,馬特·瑞安,ATL,2,波士頓學院,76.0 ....等
div標籤包含2名球員Matt Ryan和Aaron Rogers的數據。原始文件包含超過200名使用以下相同格式的玩家。
<div id="player_data" style="display: none;">
[{"player_id":8780,"position":"QB","first_name":
"Matt","last_name":"Ryan","team_alias":"Atl","number":"2","college":"Boston
College","height":76.0,"weight":217.0,"age":27,"team_city":
"Atlanta","team_name":"Falcons","experience":6,"next_matchup": [{"opponent":"Oak","game_datetime":"10/14, 1:00
PM"}],"salary":18408,"injured":false,"pstats":
[{"year":10015,"yds":714,"paint":2,"td":5,"g":2},
{"year":2012,"yds":1507,"paint":3,"td":13,"g":5},
{"year":2011,"yds":4177,"paint":12,"td":29,"g":16}],"rstats":
[{"year":10015,"yds":4,"td":0},{"year":2012,"yds":52,"td":1},
{"year":2011,"yds":84,"td":2}],"recstats":[{"year":10015,"rec":0,"yds":0,"td":0},
{"year":2012,"rec":0,"yds":0,"td":0},{"year":2011,"rec":0,"yds":0,"td":0}],"fumstats":
[{"year":10015,"fl":1},{"year":2012,"fl":1},{"year":2011,"fl":3}],"exstats":
[{"year":10015,"twopts":0},{"year":2012,"twopts":0},{"year":2011,"twopts":0}],"dstats":[]},
{"player_id":7200,"position":"QB","first_name":"Aaron","last_name":"Rodgers","team_alias":"
GB","number":"12","college":"California","height":74.0,"weight":225.0,"age":28,"team_city":
"Green Bay","team_name":"Packers","experience":9,"next_matchup":
[{"opponent":"@Hou","game_datetime":"10/14, 8:20
PM"}],"salary":17721,"injured":false,"pstats":
[{"year":10015,"yds":562,"paint":2,"td":7,"g":2},
{"year":2012,"yds":1307,"paint":4,"td":10,"g":5},
{"year":2011,"yds":4643,"paint":6,"td":45,"g":15}],"rstats":
[{"year":10015,"yds":70,"td":0},{"year":2012,"yds":108,"td":0},
{"year":2011,"yds":257,"td":3}],"recstats":[{"year":10015,"rec":0,"yds":0,"td":0},
{"year":2012,"rec":0,"yds":0,"td":0},{"year":2011,"rec":0,"yds":0,"td":0}],"fumstats"
:[{"year":2012,"fl":0},{"year":2011,"fl":0}],"exstats":[{"year":10015,"twopts":0},
{"year":2012,"twopts":0},{"year":2011,"twopts":0}],"dstats":[]}]}]</div>
謝謝你指點我在正確的方向。我會閱讀JSON。 – user1736822