S
slavon-x86
Как добраться до элементов в XML файле ?
Все, что я осилил это как вывести в memo содержимое:
[codebox]procedure TForm1.Button1Click(Sender: TObject);
var
coDoc : CoDOMDocument;
Doc, N1: IXMLDOMDocument;
begin
Doc := coDoc.Create;
Doc.load('d:/session250897746.xml');
Memo1.Text:=Doc.xml;
end;[/codebox]
Пример файла xml:
[codebox] <?xml version="1.0" encoding="UTF-8" ?>
- <ROOT>
- <HISTORY ID="1376855103" SESSION="session252909866.xml" TABLE="TH Mini 10" GAME="GAME_THM" GAMETYPE="GAMETYPE_REAL" GAMEKIND="GAMEKIND_CASH" TABLECURRENCY="USD" LIMIT="NL" STAKES="0.05/0.10" DATE="1230158040" WIN="0.00" LOSS="0.10">
<PLAYER NAME="Jeka-x87" SEAT="5" AMOUNT="2.30" />
<PLAYER NAME="aramacao" SEAT="1" AMOUNT="4.41" />
<PLAYER NAME="Flyone77" SEAT="3" AMOUNT="17.87" />
<PLAYER NAME="g?rinc_" SEAT="4" AMOUNT="1.30" />
<PLAYER NAME="vajakki" SEAT="2" AMOUNT="3.00" />
<ACTION TYPE="HAND_BLINDS" PLAYER="Jeka-x87" KIND="HAND_BB" VALUE="0.10" />
<ACTION TYPE="HAND_BLINDS" PLAYER="g?rinc_" KIND="HAND_SB" VALUE="0.05" />
<ACTION TYPE="HAND_BLINDS" PLAYER="vajakki" KIND="HAND_BB" VALUE="0.10" />
+ <ACTION TYPE="HAND_DEAL" PLAYER="g?rinc_">
<CARD LINK="b" />
<CARD LINK="b" />
</ACTION>
- <ACTION TYPE="HAND_DEAL" PLAYER="Jeka-x87">
<CARD LINK="12" />
<CARD LINK="44" />
</ACTION>
- <ACTION TYPE="HAND_DEAL" PLAYER="aramacao">
<CARD LINK="b" />
<CARD LINK="b" />
</ACTION>
- <ACTION TYPE="HAND_DEAL" PLAYER="vajakki">
<CARD LINK="b" />
<CARD LINK="b" />
</ACTION>
- <ACTION TYPE="HAND_DEAL" PLAYER="Flyone77">
<CARD LINK="b" />
<CARD LINK="b" />
</ACTION>
<ACTION TYPE="ACTION_FOLD" PLAYER="aramacao" />
<ACTION TYPE="ACTION_CHECK" PLAYER="vajakki" />
<ACTION TYPE="ACTION_FOLD" PLAYER="Flyone77" />
<ACTION TYPE="ACTION_CALL" PLAYER="g?rinc_" VALUE="0.10" />
<ACTION TYPE="ACTION_CHECK" PLAYER="Jeka-x87" />
- <ACTION TYPE="HAND_BOARD" VALUE="BOARD_FLOP" POT="0.30">
<CARD LINK="6" />
<CARD LINK="7" />
<CARD LINK="15" />
</ACTION>
<ACTION TYPE="ACTION_CHECK" PLAYER="g?rinc_" />
<ACTION TYPE="ACTION_CHECK" PLAYER="Jeka-x87" />
<ACTION TYPE="ACTION_BET" PLAYER="vajakki" VALUE="0.30" />
<ACTION TYPE="ACTION_CALL" PLAYER="g?rinc_" VALUE="0.30" />
<ACTION TYPE="ACTION_FOLD" PLAYER="Jeka-x87" />
- <ACTION TYPE="HAND_BOARD" VALUE="BOARD_TURN" POT="0.86">
<CARD LINK="6" />
<CARD LINK="7" />
<CARD LINK="15" />
<CARD LINK="42" />
</ACTION>
<ACTION TYPE="ACTION_CHECK" PLAYER="g?rinc_" />
<ACTION TYPE="ACTION_BET" PLAYER="vajakki" VALUE="0.90" />
<ACTION TYPE="ACTION_ALLIN" PLAYER="g?rinc_" VALUE="0.90" />
- <ACTION TYPE="HAND_BOARD" VALUE="BOARD_RIVER" POT="2.57">
<CARD LINK="6" />
<CARD LINK="7" />
<CARD LINK="15" />
<CARD LINK="42" />
<CARD LINK="49" />
</ACTION>
- <SHOWDOWN NAME="HAND_SHOWDOWN" POT="2.57" RAKE="0.13">
<RESULT PLAYER="aramacao" WIN="0.00" HAND="$(STR_G_FOLD)" />
- <RESULT PLAYER="vajakki" WIN="0.00" HAND="$(STR_G_WIN_PAIR) $(STR_G_CARDS_FOURS)">
<CARD LINK="25" />
<CARD LINK="3" />
</RESULT>
<RESULT PLAYER="Flyone77" WIN="0.00" HAND="$(STR_G_FOLD)" />
- <RESULT PLAYER="g?rinc_" WIN="2.57" HAND="$(STR_G_WIN_TWOPAIR) $(STR_G_CARDS_EIGHTS) $(STR_G_ANDTEXT) $(STR_G_CARDS_SEVENS)">
<CARD LINK="32" />
<CARD LINK="46" />
</RESULT>
<RESULT PLAYER="Jeka-x87" WIN="0.00" HAND="$(STR_G_FOLD)" />
</SHOWDOWN>
</HISTORY>
- <HISTORY ID="1376856009" SESSION="session252909866.xml" TABLE="TH Mini 10" GAME="GAME_THM" GAMETYPE="GAMETYPE_REAL" GAMEKIND="GAMEKIND_CASH" TABLECURRENCY="USD" LIMIT="NL" STAKES="0.05/0.10" DATE="1230158097" WIN="0.00" LOSS="0.05">
<PLAYER NAME="aramacao" SEAT="1" AMOUNT="4.41" />
<PLAYER NAME="Flyone77" SEAT="3" AMOUNT="17.87" />
<PLAYER NAME="Jeka-x87" SEAT="5" AMOUNT="2.20" />
<PLAYER NAME="vajakki" SEAT="2" AMOUNT="1.70" />
<PLAYER NAME="g?rinc_" SEAT="4" AMOUNT="2.57" />
<ACTION TYPE="HAND_BLINDS" PLAYER="aramacao" KIND="HAND_BB" VALUE="0.10" />
<ACTION TYPE="HAND_BLINDS" PLAYER="Jeka-x87" KIND="HAND_SB" VALUE="0.05" />
- <ACTION TYPE="HAND_DEAL" PLAYER="Jeka-x87">
<CARD LINK="42" />
<CARD LINK="36" />
</ACTION>
- <ACTION TYPE="HAND_DEAL" PLAYER="aramacao">
<CARD LINK="b" />
<CARD LINK="b" />
</ACTION>
- <ACTION TYPE="HAND_DEAL" PLAYER="vajakki">
<CARD LINK="b" />
<CARD LINK="b" />
</ACTION>
- <ACTION TYPE="HAND_DEAL" PLAYER="Flyone77">
<CARD LINK="b" />
<CARD LINK="b" />
</ACTION>
- <ACTION TYPE="HAND_DEAL" PLAYER="g?rinc_">
<CARD LINK="b" />
<CARD LINK="b" />
</ACTION>
<ACTION TYPE="ACTION_FOLD" PLAYER="vajakki" />
<ACTION TYPE="ACTION_FOLD" PLAYER="Flyone77" />
<ACTION TYPE="ACTION_FOLD" PLAYER="g?rinc_" />
<ACTION TYPE="ACTION_FOLD" PLAYER="Jeka-x87" />
- <SHOWDOWN NAME="HAND_SHOWDOWN" POT="0.10" RAKE="0.00">
<RESULT PLAYER="aramacao" WIN="0.10" HAND="$(STR_BY_DEFAULT)" />
<RESULT PLAYER="vajakki" WIN="0.00" HAND="$(STR_G_FOLD)" />
<RESULT PLAYER="Flyone77" WIN="0.00" HAND="$(STR_G_FOLD)" />
<RESULT PLAYER="g?rinc_" WIN="0.00" HAND="$(STR_G_FOLD)" />
<RESULT PLAYER="Jeka-x87" WIN="0.00" HAND="$(STR_G_FOLD)" />
</SHOWDOWN>
</HISTORY>
</ROOT>[/codebox]
Все, что я осилил это как вывести в memo содержимое:
[codebox]procedure TForm1.Button1Click(Sender: TObject);
var
coDoc : CoDOMDocument;
Doc, N1: IXMLDOMDocument;
begin
Doc := coDoc.Create;
Doc.load('d:/session250897746.xml');
Memo1.Text:=Doc.xml;
end;[/codebox]
Пример файла xml:
[codebox] <?xml version="1.0" encoding="UTF-8" ?>
- <ROOT>
- <HISTORY ID="1376855103" SESSION="session252909866.xml" TABLE="TH Mini 10" GAME="GAME_THM" GAMETYPE="GAMETYPE_REAL" GAMEKIND="GAMEKIND_CASH" TABLECURRENCY="USD" LIMIT="NL" STAKES="0.05/0.10" DATE="1230158040" WIN="0.00" LOSS="0.10">
<PLAYER NAME="Jeka-x87" SEAT="5" AMOUNT="2.30" />
<PLAYER NAME="aramacao" SEAT="1" AMOUNT="4.41" />
<PLAYER NAME="Flyone77" SEAT="3" AMOUNT="17.87" />
<PLAYER NAME="g?rinc_" SEAT="4" AMOUNT="1.30" />
<PLAYER NAME="vajakki" SEAT="2" AMOUNT="3.00" />
<ACTION TYPE="HAND_BLINDS" PLAYER="Jeka-x87" KIND="HAND_BB" VALUE="0.10" />
<ACTION TYPE="HAND_BLINDS" PLAYER="g?rinc_" KIND="HAND_SB" VALUE="0.05" />
<ACTION TYPE="HAND_BLINDS" PLAYER="vajakki" KIND="HAND_BB" VALUE="0.10" />
+ <ACTION TYPE="HAND_DEAL" PLAYER="g?rinc_">
<CARD LINK="b" />
<CARD LINK="b" />
</ACTION>
- <ACTION TYPE="HAND_DEAL" PLAYER="Jeka-x87">
<CARD LINK="12" />
<CARD LINK="44" />
</ACTION>
- <ACTION TYPE="HAND_DEAL" PLAYER="aramacao">
<CARD LINK="b" />
<CARD LINK="b" />
</ACTION>
- <ACTION TYPE="HAND_DEAL" PLAYER="vajakki">
<CARD LINK="b" />
<CARD LINK="b" />
</ACTION>
- <ACTION TYPE="HAND_DEAL" PLAYER="Flyone77">
<CARD LINK="b" />
<CARD LINK="b" />
</ACTION>
<ACTION TYPE="ACTION_FOLD" PLAYER="aramacao" />
<ACTION TYPE="ACTION_CHECK" PLAYER="vajakki" />
<ACTION TYPE="ACTION_FOLD" PLAYER="Flyone77" />
<ACTION TYPE="ACTION_CALL" PLAYER="g?rinc_" VALUE="0.10" />
<ACTION TYPE="ACTION_CHECK" PLAYER="Jeka-x87" />
- <ACTION TYPE="HAND_BOARD" VALUE="BOARD_FLOP" POT="0.30">
<CARD LINK="6" />
<CARD LINK="7" />
<CARD LINK="15" />
</ACTION>
<ACTION TYPE="ACTION_CHECK" PLAYER="g?rinc_" />
<ACTION TYPE="ACTION_CHECK" PLAYER="Jeka-x87" />
<ACTION TYPE="ACTION_BET" PLAYER="vajakki" VALUE="0.30" />
<ACTION TYPE="ACTION_CALL" PLAYER="g?rinc_" VALUE="0.30" />
<ACTION TYPE="ACTION_FOLD" PLAYER="Jeka-x87" />
- <ACTION TYPE="HAND_BOARD" VALUE="BOARD_TURN" POT="0.86">
<CARD LINK="6" />
<CARD LINK="7" />
<CARD LINK="15" />
<CARD LINK="42" />
</ACTION>
<ACTION TYPE="ACTION_CHECK" PLAYER="g?rinc_" />
<ACTION TYPE="ACTION_BET" PLAYER="vajakki" VALUE="0.90" />
<ACTION TYPE="ACTION_ALLIN" PLAYER="g?rinc_" VALUE="0.90" />
- <ACTION TYPE="HAND_BOARD" VALUE="BOARD_RIVER" POT="2.57">
<CARD LINK="6" />
<CARD LINK="7" />
<CARD LINK="15" />
<CARD LINK="42" />
<CARD LINK="49" />
</ACTION>
- <SHOWDOWN NAME="HAND_SHOWDOWN" POT="2.57" RAKE="0.13">
<RESULT PLAYER="aramacao" WIN="0.00" HAND="$(STR_G_FOLD)" />
- <RESULT PLAYER="vajakki" WIN="0.00" HAND="$(STR_G_WIN_PAIR) $(STR_G_CARDS_FOURS)">
<CARD LINK="25" />
<CARD LINK="3" />
</RESULT>
<RESULT PLAYER="Flyone77" WIN="0.00" HAND="$(STR_G_FOLD)" />
- <RESULT PLAYER="g?rinc_" WIN="2.57" HAND="$(STR_G_WIN_TWOPAIR) $(STR_G_CARDS_EIGHTS) $(STR_G_ANDTEXT) $(STR_G_CARDS_SEVENS)">
<CARD LINK="32" />
<CARD LINK="46" />
</RESULT>
<RESULT PLAYER="Jeka-x87" WIN="0.00" HAND="$(STR_G_FOLD)" />
</SHOWDOWN>
</HISTORY>
- <HISTORY ID="1376856009" SESSION="session252909866.xml" TABLE="TH Mini 10" GAME="GAME_THM" GAMETYPE="GAMETYPE_REAL" GAMEKIND="GAMEKIND_CASH" TABLECURRENCY="USD" LIMIT="NL" STAKES="0.05/0.10" DATE="1230158097" WIN="0.00" LOSS="0.05">
<PLAYER NAME="aramacao" SEAT="1" AMOUNT="4.41" />
<PLAYER NAME="Flyone77" SEAT="3" AMOUNT="17.87" />
<PLAYER NAME="Jeka-x87" SEAT="5" AMOUNT="2.20" />
<PLAYER NAME="vajakki" SEAT="2" AMOUNT="1.70" />
<PLAYER NAME="g?rinc_" SEAT="4" AMOUNT="2.57" />
<ACTION TYPE="HAND_BLINDS" PLAYER="aramacao" KIND="HAND_BB" VALUE="0.10" />
<ACTION TYPE="HAND_BLINDS" PLAYER="Jeka-x87" KIND="HAND_SB" VALUE="0.05" />
- <ACTION TYPE="HAND_DEAL" PLAYER="Jeka-x87">
<CARD LINK="42" />
<CARD LINK="36" />
</ACTION>
- <ACTION TYPE="HAND_DEAL" PLAYER="aramacao">
<CARD LINK="b" />
<CARD LINK="b" />
</ACTION>
- <ACTION TYPE="HAND_DEAL" PLAYER="vajakki">
<CARD LINK="b" />
<CARD LINK="b" />
</ACTION>
- <ACTION TYPE="HAND_DEAL" PLAYER="Flyone77">
<CARD LINK="b" />
<CARD LINK="b" />
</ACTION>
- <ACTION TYPE="HAND_DEAL" PLAYER="g?rinc_">
<CARD LINK="b" />
<CARD LINK="b" />
</ACTION>
<ACTION TYPE="ACTION_FOLD" PLAYER="vajakki" />
<ACTION TYPE="ACTION_FOLD" PLAYER="Flyone77" />
<ACTION TYPE="ACTION_FOLD" PLAYER="g?rinc_" />
<ACTION TYPE="ACTION_FOLD" PLAYER="Jeka-x87" />
- <SHOWDOWN NAME="HAND_SHOWDOWN" POT="0.10" RAKE="0.00">
<RESULT PLAYER="aramacao" WIN="0.10" HAND="$(STR_BY_DEFAULT)" />
<RESULT PLAYER="vajakki" WIN="0.00" HAND="$(STR_G_FOLD)" />
<RESULT PLAYER="Flyone77" WIN="0.00" HAND="$(STR_G_FOLD)" />
<RESULT PLAYER="g?rinc_" WIN="0.00" HAND="$(STR_G_FOLD)" />
<RESULT PLAYER="Jeka-x87" WIN="0.00" HAND="$(STR_G_FOLD)" />
</SHOWDOWN>
</HISTORY>
</ROOT>[/codebox]