Hello Thiyagarajan,
To reduce your code you have to create one secondary file with sourceXPath and destinationXPath fields.
Example:
<MappingNodes>
<MappingNode>
<Mapping sourceXPath ="" destinationXPath=""/>
<Mapping sourceXPath ="" destinationXPath=""/>
</MappingNode>
</MappingNodes>
Code: Here is the code,
//Get the list of nodes from secondary dom.
IXMLDOMNodeList MappingNodes = thisXDocument.GetDOM("DOM Name").selectNodes( "/ MappingNodes/MappingNode/Mapping");
foreach (IXMLDOMNode MappingNode in MappingNodes)
{
//Get the source XPath of node
string sourceXPath = MappingNode.selectSingleNode("@sourceXPath");
//Get the destination XPath of node
string destinationXPath = MappingNode.selectSingleNode("@destinationXPath");
//Get the source value from secondary dom
string sourceValue = thisXDocument.GetDOM("DOM Name").selectSingleNode(sourceXPath);
//Set the source vlaue to destination node
thisXDocument.DOM.selecteSingleNode(destinationXPath, sourceValue);
}