Click here to Skip to main content
15,902,189 members
Home / Discussions / C#
   

C#

 
GeneralRe: Stringbuilder Pin
jeramyRR16-Apr-12 20:00
jeramyRR16-Apr-12 20:00 
AnswerRe: Stringbuilder PinPopular
Abhinav S16-Apr-12 19:50
Abhinav S16-Apr-12 19:50 
GeneralRe: Stringbuilder Pin
VJ Reddy16-Apr-12 19:58
VJ Reddy16-Apr-12 19:58 
GeneralRe: Stringbuilder Pin
Anurag Sarkar16-Apr-12 19:59
Anurag Sarkar16-Apr-12 19:59 
AnswerRe: Stringbuilder Pin
Keith Barrow16-Apr-12 23:00
professionalKeith Barrow16-Apr-12 23:00 
GeneralRe: Stringbuilder Pin
VJ Reddy16-Apr-12 23:31
VJ Reddy16-Apr-12 23:31 
QuestionProgramatically add digital signature to a document uploaded in Sharepoint library Pin
NishaTM16-Apr-12 16:48
NishaTM16-Apr-12 16:48 
QuestionOptimising XML Pin
si_6916-Apr-12 8:01
si_6916-Apr-12 8: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()); 
        } 

AnswerRe: Optimising XML Pin
PIEBALDconsult16-Apr-12 11:05
mvePIEBALDconsult16-Apr-12 11:05 
SuggestionRe: Optimising XML Pin
RobCroll16-Apr-12 18:10
RobCroll16-Apr-12 18:10 
QuestionError in loading excel file in windows 7 ... Pin
nassimnastaran16-Apr-12 5:34
nassimnastaran16-Apr-12 5:34 
AnswerRe: Error in loading excel file in windows 7 ... Pin
Pete O'Hanlon16-Apr-12 5:41
mvePete O'Hanlon16-Apr-12 5:41 
GeneralRe: Error in loading excel file in windows 7 ... Pin
nassimnastaran16-Apr-12 6:47
nassimnastaran16-Apr-12 6:47 
AnswerRe: Error in loading excel file in windows 7 ... Pin
Wes Aday16-Apr-12 7:01
professionalWes Aday16-Apr-12 7:01 
GeneralRe: Error in loading excel file in windows 7 ... Pin
nassimnastaran16-Apr-12 7:32
nassimnastaran16-Apr-12 7:32 
GeneralRe: Error in loading excel file in windows 7 ... Pin
Wes Aday16-Apr-12 9:02
professionalWes Aday16-Apr-12 9:02 
AnswerRe: Error in loading excel file in windows 7 ... Pin
Eddy Vluggen16-Apr-12 8:28
professionalEddy Vluggen16-Apr-12 8:28 
Questionsoap headers are not added Pin
anandsurya16-Apr-12 0:19
anandsurya16-Apr-12 0:19 
AnswerPlease ignore - cross posted. Pin
Pete O'Hanlon16-Apr-12 0:26
mvePete O'Hanlon16-Apr-12 0:26 
Question.net Framework Pin
Mandeep Sembhi15-Apr-12 23:04
Mandeep Sembhi15-Apr-12 23:04 
AnswerRe: .net Framework PinPopular
egenis15-Apr-12 23:13
egenis15-Apr-12 23:13 
AnswerRe: .net Framework Pin
VJ Reddy15-Apr-12 23:16
VJ Reddy15-Apr-12 23:16 
QuestionPlease I need help on this because it's not filling the form Pin
relicon15-Apr-12 15:39
relicon15-Apr-12 15:39 
AnswerRe: Please I need help on this because it's not filling the form Pin
relicon15-Apr-12 15:40
relicon15-Apr-12 15:40 
GeneralRe: Please I need help on this because it's not filling the form Pin
BobJanova15-Apr-12 23:35
BobJanova15-Apr-12 23:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.