タイトル : Re^6: XMLのデータ追加について 投稿日 : 2008/05/14(Wed) 18:56 投稿者 : 魔界の仮面弁士
>> VB2008 等を前提とした回答で良いのかな? > そのとおりです。 であれば、このようにも書けるかな。 Dim doc = _ <root> <data id="1"> <sub>aaa</sub> </data> <data id="2"> <sub>bbb</sub> </data> </root> Dim target = From node In doc...<data> Where node.@id = "2" If target.Count = 0 Then MsgBox( "id=2 のノードはありません。" ) Else target(0).AddAfterSelf( <data id="8"><sub>ccc</sub></data> ) MsgBox( doc.ToString() ) End If |