I'm using InfoPath 2003. Finally i found a way to do it. A little different
than your suggestions, but following your instructions. One thing different
that i did was copy the xml of my field A into a string variable and only
replace the name of the child for the field2 and then do a replace child from
parent node of both fields.
IXMLDOMNode node1 =
doc.DOM.documentElement.selectSingleNode("./my
arentnode/my:Field1");
if (node1 != null)
{
IXMLDOMDocument newchild = doc.CreateDOM();
childtext = node1.xml.ToString();
string newtxtofnode2= childtext.Replace("NameOfChild_1",
"NameOfChild_2");
newchild.loadXML(newtxtofnode2);
oldchild =
doc.DOM.documentElement.selectSingleNode("./my
arentNode/my:Field2");
oldchild.parentNode.replaceChild(newchild.documentElement, oldchild);
}
And it works !!
Thanks for your help !