End Google Ads 201810 - BS.net 01 --> Hi All

I am trying to find a way to optimise the below code for my web service

In my webservice i recieve 10 different XML files, each xml file is always the same format, at the moment i have 10 different methods to handle each one, the below code is an example of one of the methods.

The only difference between the methods are the local variables and the node attributes.

Instead of having 10 methods almost identical i would like to have just one.

Can anyone advise on the best way to achieve this ?

thanks

public void NavigateXmlSessionData(XPathNavigator xPathNav) { xPathNav.MoveToRoot(); xPathNav.MoveToFirstChild(); xPathNav.MoveToFirstChild(); string description, personId; // initalise vars description = ""; personId = ""; do { //display the child nodes if (xPathNav.MoveToFirstChild()) { while (xPathNav.MoveToNext()) { switch (xPathNav.Name) { #region NodeAttributes case "Description": { StringBuilder strBuild = new StringBuilder(xPathNav.Value, 200); description = strBuild.Replace('\'', ' ').ToString(); break; } case "PersonId": { StringBuilder strBuild = new StringBuilder(xPathNav.Value, 200); personId = strBuild.Replace('\'', ' ').ToString(); break; } #endregion } } //move back to the parent xPathNav.MoveToParent(); } ProcessRecord(); // initalise vars description = ""; personId = ""; } while (xPathNav.MoveToNext()); }