помогите считать инфу с xml
- <pinnacle_line_feed>
<PinnacleFeedTime>1202318022685</PinnacleFeedTime>
- <events>
- <event>
<event_datetimeGMT>2008-02-06 18:00</event_datetimeGMT>
<gamenumber>116408483</gamenumber>
<sporttype>Bandy</sporttype>
<league>Norway Elite</league>
- <participants>
- <participant>
<participant_name>Sarpsborg</participant_name>
<contestantnum>1001</contestantnum>
<rotnum>1001</rotnum>
<visiting_home_draw>Visiting</visiting_home_draw>
</participant>
- <participant>
<participant_name>Ready</participant_name>
<contestantnum>1002</contestantnum>
<rotnum>1002</rotnum>
<visiting_home_draw>Home</visiting_home_draw>
</participant>
</participants>
- <periods>
- <period>
<period_number>0</period_number>
<period_description>Game</period_description>
<periodcutoff_datetimeGMT>2008-02-06 18:00</periodcutoff_datetimeGMT>
<period_status>I</period_status>
<period_update>open</period_update>
<spread_maximum>100</spread_maximum>
<moneyline_maximum>100</moneyline_maximum>
<total_maximum>100</total_maximum>
- <moneyline>
<moneyline_visiting>110</moneyline_visiting>
<moneyline_home>-120</moneyline_home>
</moneyline>
- <spread>
<spread_visiting>1.5</spread_visiting>
<spread_adjust_visiting>-212</spread_adjust_visiting>
<spread_home>-1.5</spread_home>
<spread_adjust_home>192</spread_adjust_home>
</spread>
- <total>
<total_points>9</total_points>
<over_adjust>-106</over_adjust>
<under_adjust>-104</under_adjust>
</total>
</period>
</periods>
</event>
...
я пока что сделал так
Dim strread As New IO.StreamReader("pinnaclesports.xml")
Dim ios As IO.Stream = strread.BaseStream
Dim myXml As New Xml.XPath.XPathDocument(ios)
Dim strcommand As String
Dim strWin1 As String
Dim strWin2 As String
strcommand = myXml.CreateNavigator.SelectSingleNode("/pinnacle_line_feed/events/event/participants/participant/participant_name").Value
strcommand += " - "
strcommand += myXml.CreateNavigator.SelectSingleNode("/pinnacle_line_feed/events/event/participants/participant/participant_name").Value
strWin1 = myXml.CreateNavigator.SelectSingleNode("/pinnacle_line_feed/events/event/periods/period/moneyline/moneyline_visiting").Value
strWin2 = myXml.CreateNavigator.SelectSingleNode("/pinnacle_line_feed/events/event/periods/period/moneyline/moneyline_home").Value
strread.Close()
а как теперь зациклить этот процесс? while ...
и еще что будет, если в какой-то части не будет <period></period>. нужно ли делать проверку или он вернет что-нибудь вроде пустой строки? если нужно, то как? заранее спасибо.
Ответить
|