次のようなxpathの文字列があります
/root/parent/child
/root/parent/child[1]
/root/parent/child[2]
C#コードでは、XmlDocumentにxpathが存在するかどうかを確認し、このように複製しています
//Get the parent node of the node to be cloned
XmlNode NodeTobeCloned = xmlDoc.SelectSingleNode(oRow[0].ToString());
XmlNode DuplicateNode = NodeTobeCloned.CloneNode(true);
DuplicateNode.InnerText = sValue;
//Insert the node after the last child of a commoon parent
NodeTobeCloned.ParentNode.AppendChild(DuplicateNode);
私は次のような結果を得ています
<root>
<parent>
<child/>
<child/>
<child/>
</parent>
</root>
のような結果が欲しい
<root>
<parent>
<child/>
</parent>
<parent>
<child/> -- [1] -predicates elements
</parent>
<parent>
<child/> -- [2] -predicates elements
</parent>
</root>
c# を使用して xmldocument に追加するにはどうすればよいですか?