本文介绍了如何在c#.net windows应用程序的数据集中阅读下面的xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<root>
<common>
<log code ="c001" msg="You are seated on "/>
<log code ="c002" msg="Socket Connected"/>
<log code ="c003" msg="Place your bets"/>
<log code ="c004" msg="Game Timer Activated"/>
<log code ="c005" msg="Sending bets"/>
<log code ="c006" msg="Bet Posted Amount"/>
<log code ="c007" msg="Bet Sent Successfully"/>
<log code ="c008" msg="Sending Additional Bet"/>
<log code ="c009" msg="Additional Bet Sent Successfully"/>
<log code ="c010" msg="Bet Bar Deactivated"/>
<log code ="c011" msg="Bet not accepted"/>
<log code ="c012" msg="Chips are Cleared from table"/>
<log code ="c013" msg="Total Bet Amount - "/>
<log code ="c014" msg="Game in Progress"/>
<log code ="c015" msg="Socket Disconnected"/>
<log code ="c016" msg="Socket Reconnected"/>
<log code ="c017" msg="Game Mode Changed"/>
<log code ="c018" msg="Game Exit"/>
<log code ="c019" msg="Video has been Stopped"/>
<log code ="c020" msg="Player Kicked out"/>
<log code ="c021" msg="More than one user Logged in"/>
<log code ="c022" msg="New Game ID"/>
<log code ="c023" msg="Game Timer deactivated"/>
<log code ="c024" msg="Updating Balance"/>
<log code ="c025" msg="Player Logged in another window"/>
<log code ="c026" msg="Game Cancelled"/>
<log code ="c027" msg="Failed to post bet"/>
<log code ="c028" msg="Last card cancelled"/>
<log code ="c029" msg="Bet Amount refunded"/>
<log code ="c030" msg="Internet Connection Problem"/>
<log code ="c031" msg="Please wait while shuffle Cards"/>
<log code ="c032" msg="Please wait while we change dealers"/>
<log code ="c033" msg="No More Bets"/>
<log code ="c034" msg="Please wait for next game"/>
<log code ="c035" msg="Player Win limit exceeded. Bets are not accepted"/>
<log code ="c036" msg="Player Win "/>
</common>
<Baccarat>
<log code ="bc001" msg="Player Card"/>
<log code ="bc002" msg="Banker Card"/>
<log code ="bc003" msg="Result"/>
<log code ="bc004" msg="Game Result"/>
<log code ="bc005" msg="Stats Updated"/>
<log code ="bc006" msg="Stats not Updated"/>
<log code ="bc007" msg="Player"/>
<log code ="bc008" msg="Banker"/>
<log code ="bc009" msg="Tie"/>
<log code ="bc010" msg="Player Pair"/>
<log code ="bc011" msg="Banker Pair"/>
<log code ="bc012" msg="Clear Game"/>
<log code ="bc013" msg="Please wait for next game"/>
<log code ="bc014" msg="Seat Changed"/>
</Baccarat>
<DT>
<log code ="dtc001" msg="Dragon Card"/>
<log code ="dtc002" msg="Tiger Card"/>
<log code ="dtc003" msg="Player Result"/>
<log code ="dtc004" msg="Game Result"/>
<log code ="dtc005" msg="Stats Updated"/>
<log code ="dtc006" msg="Stats not Updated"/>
</DT>
<Blackjack>
<log code ="bjc001" msg="Player Card"/>
<log code ="bjc002" msg="Dealer Card"/>
<log code ="bjc003" msg="Insurance Accepted"/>
<log code ="bjc004" msg="Insurance not Activated"/>
<log code ="bjc005" msg="Decision Bar Activated"/>
<log code ="bjc006" msg="Decision Bar not Activated"/>
<log code ="bjc007" msg="Split Requested"/>
<log code ="bjc008" msg="Split Accepted amount"/>
<log code ="bjc009" msg="Split not Accepted"/>
<log code ="bjc010" msg="Double Requested"/>
<log code ="bjc011" msg="Double Accepted"/>
<log code ="bjc012" msg="Double not Accepted"/>
<log code ="bjc013" msg="Hit Requested"/>
<log code ="bjc014" msg="Hit Accepted"/>
<log code ="bjc015" msg="Hit not Accepted"/>
<log code ="bjc016" msg="Stand Requested"/>
<log code ="bjc017" msg="Stand Accepted"/>
<log code ="bjc018" msg="Stand not Accepted"/>
<log code ="bjc019" msg="Player Result"/>
<log code ="bjc020" msg="Game Result"/>
<log code ="bjc021" msg="Stats Updated"/>
<log code ="bjc022" msg="Stats not Updated"/>
<log code ="bjc023" msg="Betbehind game Result"/>
<log code ="bjc024" msg="Bet Sent Successfully "/>
<log code ="bjc025" msg="Player session expired"/>
<log code ="bjc026" msg="Insured Amount"/>
<log code ="bjc027" msg="Double Amount"/>
<log code ="bjc028" msg="pre-Decision Bar Activated"/>
<log code ="bjc029" msg="pre-Decision Bar deActivated"/>
<log code ="bjc030" msg="pre-Insurance Requested"/>
<log code ="bjc031" msg="pre-Insurance Accepted"/>
<log code ="bjc032" msg="pre-Insurance not Activated"/>
<log code ="bjc033" msg="pre-Split Requested"/>
<log code ="bjc034" msg="pre-Split Accepted amount"/>
<log code ="bjc035" msg="pre-Split not Accepted"/>
<log code ="bjc036" msg="pre-Double Requested"/>
<log code ="bjc037" msg="pre-Double Accepted"/>
<log code ="bjc038" msg="pre-Double not Accepted"/>
<log code ="bjc039" msg="pre-Hit Requested"/>
<log code ="bjc040" msg="pre-Hit Accepted"/>
<log code ="bjc041" msg="pre-Hit not Accepted"/>
<log code ="bjc042" msg="pre-Stand Requested"/>
<log code ="bjc043" msg="pre-Stand Accepted"/>
<log code ="bjc044" msg="pre-Stand not Accepted"/>
</Blackjack>
<Roulette>
<log code ="rc001" msg="Player"/>
<log code ="rc002" msg="Game Result : "/>
<log code ="rc003" msg="Stats Updated"/>
<log code ="rc004" msg="Stats not Updated"/>
<log code ="rc005" msg="Hot Cold & Stats Updated"/>
<log code ="rc006" msg="Hot Cold not Updated"/>
<log code ="rc007" msg=" Sending bets "/>
<log code ="rc008" msg="Autobet Spin Count"/>
<log code =" rc009" msg="Autobet Posted Amount"/>
<log code ="rc010" msg="Bets Sent Successfully"/>
<log code ="rc011" msg="Autobet will stop in the next game"/>
</Roulette>
<Sicbo>
<log code ="sc001" msg="Player "/>
<log code ="sc002" msg="Game Result : "/>
<log code ="sc003" msg="Stats Updated"/>
<log code ="sc004" msg="Stats not Updated"/>
<log code ="sc005" msg="HC Updated"/>
<log code ="sc006" msg="HC not Updated"/>
<log code ="sc007" msg="Game Canceled"/>
<log code ="sc008" msg="Autobet Posted"/>
<log code ="sc009" msg="Autobet Spin Count"/>
<log code ="sc010" msg="Autobet Posted Amount"/>
<log code ="sc011" msg="Autobet Accepted"/>
<log code ="sc012" msg="Autobet will stop in the next game"/>
<log code ="sc013" msg="Win Amount "/>
</Sicbo>
</root>
推荐答案
string path = "D:\XmlData\data.xml";
DataSet ds = new DataSet();
ds.ReadXml(path);
Then you can processed data in dataSet ’ds’ as of your requirement.
To read node by node (record by record )
Then you can processed data in dataSet 'ds' as of your requirement.
To read node by node (record by record )
string path = "D:\XmlData\data.xml"; // path of your xml file
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(path);
// as of your xml structure
XmlNode Node = xmlDoc.SelectSingleNode("root/common");
// then traverse one by one
foreach(XmlNode SingleNode in Node.ChildNodes) {
//processing code here
}
这篇关于如何在c#.net windows应用程序的数据集中阅读下面的xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!