Linq を使用して、XML のすべての既存の値を辞書の値に置き換える方法はありますか? 私はc#を使用しています。
XML の例:
<root>
<node1> <--without attribute
<subNode1>someTextValue</subNode1>
</node1>
<node2 name="myNode2"> <--With attribute (IMPORTANT!!!)
<subNod1>someOtherTextValue</subNode1>
</node2>
</root>
Dictionary<string, Hashtable> dataFromXML;
dataFromXML Keys
例からnode1 (because here is note an attribute), myNode2 (because here is an attribute)
...
dataFromXML Values
サブノードです。
ここで、いくつかの subNode でいくつかの値を変更し、XML を更新したいとしましょう。
foreach でループする代わりに、どうすればこれを行うことができますか???
私の質問が明確に定義されていることを願っています。
編集
XElement と ReplaceWith 関数はどうですか?
よろしくお願いします。