Не удается спарсить нужные элементы в Xml документе - C#

Узнай цену своей работы

Формулировка задачи:

Всем привет возникла такая не удачная ситуация есть вот такой Xml документ
<data> 
    <presents> 
        <present id="1" level="1" energy="3" /> 
        <present id="2" level="10" energy="5" /> 
        <present id="3" level="30" energy="7" /> 
        <present id="4" level="50" energy="8" /> 
        <present id="5" level="80" energy="10" /> 
    </presents> 
    <friends> 
        <uid>6262795</uid> 
        <uid>52321324</uid> 
        <uid>37233961</uid> 
        <uid>106664090</uid> 
        <uid>135197212</uid> 
        <uid>95161629</uid> 
        <uid>20509749</uid> 
        <uid>112842898</uid> 
        <uid>67270020</uid> 
        <uid>135939724</uid> 
        <uid>19493314</uid> 
        <uid>108085295</uid> 
        <uid>66089443</uid> 
        <uid>63399291</uid> 
        <uid>157166480</uid> 
        <uid>77416428</uid> 
        <uid>25341324</uid> 
        <uid>9234903</uid> 
        <uid>13574032</uid> 
        <uid>101939183</uid> 
        <uid>196103556</uid> 
        <uid>172111984</uid> 
        <uid>93827100</uid> 
        <uid>30611553</uid> 
        <uid>152013878</uid> 
        <uid>52957574</uid> 
        <uid>84892895</uid> 
        <uid>44052420</uid> 
        <uid>62466143</uid> 
        <uid>133896231</uid> 
        <uid>73041798</uid> 
        <uid>7207746</uid> 
        <uid>84560179</uid> 
        <uid>100597009</uid> 
        <uid>134075507</uid> 
        <uid>154417806</uid> 
        <uid>171216302</uid> 
        <uid>34602024</uid> 
        <uid>101196366</uid> 
        <uid>139714767</uid> 
        <uid>96357017</uid> 
        <uid>66569374</uid> 
        <uid>119790529</uid> 
        <uid>137088099</uid> 
        <uid>125553128</uid> 
        <uid>114788604</uid> 
        <uid>42213576</uid> 
        <uid>228662281</uid> 
        <uid>184428955</uid> 
        <uid>10675261</uid> 
        <uid>144520892</uid> 
        <uid>69654516</uid> 
        <uid>9731432</uid> 
        <uid>104191404</uid> 
        <uid>65790709</uid> 
        <uid>95169099</uid> 
        <uid>14381909</uid> 
        <uid>141570339</uid> 
        <uid>14585447</uid> 
        <uid>49221436</uid> 
        <uid>100244556</uid> 
        <uid>105885441</uid> 
        <uid>215671445</uid> 
        <uid>125235139</uid> 
        <uid>138539748</uid> 
        <uid>48303145</uid> 
        <uid>144103429</uid> 
        <uid>89256218</uid> 
        <uid>110950723</uid> 
        <uid>88964095</uid> 
        <uid>122299084</uid> 
        <uid>98819017</uid> 
        <uid>72159789</uid> 
        <uid>49471844</uid> 
        <uid>153097513</uid> 
        <uid>60640883</uid> 
        <uid>33686002</uid> 
        <uid>75918035</uid> 
        <uid>86860223</uid> 
        <uid>109530299</uid> 
        <uid>55754824</uid> 
        <uid>149100053</uid> 
        <uid>141221145</uid> 
        <uid>73894048</uid> 
        <uid>100793098</uid> 
        <uid>140102118</uid> 
        <uid>164827582</uid> 
        <uid>135242555</uid> 
        <uid>47508554</uid> 
        <uid>106953227</uid> 
        <uid>160978642</uid> 
        <uid>146048323</uid> 
        <uid>144840551</uid> 
        <uid>120925986</uid> 
        <uid>161097106</uid> 
        <uid>159469048</uid> 
        <uid>131894101</uid> 
        <uid>55572428</uid> 
        <uid>102081554</uid> 
        <uid>145502099</uid> 
        <uid>7807509</uid> 
        <uid>105141287</uid> 
        <uid>107611640</uid> 
        <uid>142526759</uid> 
        <uid>138041907</uid> 
        <uid>82784141</uid> 
        <uid>100656883</uid> 
        <uid>120778524</uid> 
        <uid>131848800</uid> 
        <uid>2151672</uid> 
        <uid>137343636</uid> 
        <uid>101130924</uid> 
        <uid>198046955</uid> 
        <uid>128977308</uid> 
        <uid>169273295</uid> 
        <uid>156435507</uid> 
        <uid>19068741</uid> 
        <uid>114155932</uid> 
        <uid>97834862</uid> 
        <uid>138712864</uid> 
        <uid>64500275</uid> 
        <uid>116757114</uid> 
        <uid>10611504</uid> 
        <uid>137760614</uid> 
        <uid>155088159</uid> 
        <uid>7414125</uid> 
        <uid>60215087</uid> 
        <uid>69752529</uid> 
        <uid>34160078</uid> 
        <uid>170844563</uid> 
        <uid>146428731</uid> 
        <uid>120457457</uid> 
        <uid>146886745</uid> 
        <uid>63457051</uid> 
        <uid>33307651</uid> 
        <uid>23011568</uid> 
        <uid>143575485</uid> 
        <uid>146451251</uid> 
        <uid>138595048</uid> 
        <uid>36284565</uid> 
        <uid>99172482</uid> 
        <uid>22244081</uid> 
        <uid>93824130</uid> 
        <uid>195354127</uid> 
        <uid>166223278</uid> 
        <uid>89369376</uid> 
        <uid>31096060</uid> 
        <uid>5935631</uid> 
        <uid>3893685</uid> 
        <uid>198790902</uid> 
        <uid>94960702</uid> 
        <uid>224126578</uid> 
        <uid>139735878</uid> 
        <uid>94171143</uid> 
        <uid>185105307</uid> 
        <uid>56509141</uid> 
        <uid>143693342</uid> 
        <uid>139263634</uid> 
        <uid>179348700</uid> 
        <uid>87034473</uid> 
        <uid>51119515</uid> 
        <uid>68682301</uid> 
        <uid>95209331</uid> 
        <uid>84364382</uid> 
        <uid>125528066</uid> 
        <uid>171606687</uid> 
        <uid>31891380</uid> 
        <uid>108010829</uid> 
        <uid>27055180</uid> 
        <uid>63262582</uid> 
        <uid>93939896</uid> 
        <uid>15863483</uid> 
        <uid>93551073</uid> 
        <uid>67253345</uid> 
        <uid>67524542</uid> 
        <uid>85009327</uid> 
        <uid>112277343</uid> 
        <uid>112957618</uid> 
        <uid>131929935</uid> 
        <uid>216684565</uid> 
        <uid>154260249</uid> 
        <uid>191470532</uid> 
        <uid>137059452</uid> 
        <uid>144861470</uid> 
        <uid>93901910</uid> 
        <uid>130268014</uid> 
        <uid>28873624</uid> 
        <uid>84673486</uid> 
        <uid>101814032</uid> 
        <uid>83187139</uid> 
        <uid>138204123</uid> 
        <uid>27140634</uid> 
        <uid>32358767</uid> 
        <uid>84355918</uid> 
        <uid>109521406</uid> 
        <uid>81139500</uid> 
        <uid>99587830</uid> 
        <uid>7162785</uid> 
        <uid>118601240</uid> 
        <uid>10690489</uid> 
        <uid>70169987</uid> 
        <uid>76265769</uid> 
        <uid>104931194</uid> 
        <uid>107265493</uid> 
        <uid>167671415</uid> 
        <uid>206377305</uid> 
        <uid>36103674</uid> 
        <uid>146143265</uid> 
        <uid>143361498</uid> 
        <uid>25453724</uid> 
        <uid>79408000</uid> 
        <uid>87437940</uid> 
        <uid>94038964</uid> 
        <uid>96119379</uid> 
        <uid>135820991</uid> 
        <uid>158826785</uid> 
        <uid>149266662</uid> 
        <uid>56794796</uid> 
        <uid>191606982</uid> 
        <uid>54692644</uid> 
        <uid>72738164</uid> 
        <uid>157386074</uid> 
        <uid>136469555</uid> 
        <uid>1244001</uid> 
        <uid>114671557</uid> 
        <uid>221764593</uid> 
        <uid>123890186</uid> 
        <uid>138825251</uid> 
        <uid>138382774</uid> 
        <uid>77517434</uid> 
        <uid>32274697</uid> 
        <uid>53721759</uid> 
        <uid>7213660</uid> 
        <uid>21279960</uid> 
        <uid>131810762</uid> 
        <uid>23878722</uid> 
        <uid>164077791</uid> 
        <uid>258331226</uid> 
        <uid>236857445</uid> 
        <uid>6953832</uid> 
        <uid>6964918</uid> 
        <uid>14748607</uid> 
        <uid>147010053</uid> 
        <uid>150984187</uid> 
        <uid>135339674</uid> 
        <uid>2166427</uid> 
        <uid>97236806</uid> 
        <uid>134801915</uid> 
        <uid>93115793</uid> 
        <uid>158349215</uid> 
        <uid>46432660</uid> 
        <uid>15836931</uid> 
        <uid>9850342</uid> 
        <uid>24909281</uid> 
        <uid>141862722</uid> 
        <uid>137984398</uid> 
        <uid>184709002</uid> 
        

Решение задачи: «Не удается спарсить нужные элементы в Xml документе»

textual
Листинг программы
            foreach (XmlNode id_drhhh in xml.SelectNodes("//data/friends/uid"))
                 
            {
                
              
                Invoke((Action)delegate() { richTextBox2.AppendText(id_drhhh.InnerText + "\n"); });
 
              
            }

ИИ поможет Вам:


  • решить любую задачу по программированию
  • объяснить код
  • расставить комментарии в коде
  • и т.д
Попробуйте бесплатно

Оцени полезность:

9   голосов , оценка 3.889 из 5