Click here to Skip to main content
15,917,061 members
Home / Discussions / C#
   

C#

 
QuestionAny progammers in the Oak Harbor, WA area? Pin
jeramyRR17-Apr-12 6:30
jeramyRR17-Apr-12 6:30 
AnswerRe: Any progammers in the Oak Harbor, WA area? Pin
Abhinav S17-Apr-12 7:00
Abhinav S17-Apr-12 7:00 
GeneralRe: Any progammers in the Oak Harbor, WA area? Pin
jeramyRR17-Apr-12 8:42
jeramyRR17-Apr-12 8:42 
Questiondesign of a commercial site Pin
tuhami17-Apr-12 6:09
tuhami17-Apr-12 6:09 
AnswerRe: design of a commercial site Pin
Eddy Vluggen17-Apr-12 6:31
professionalEddy Vluggen17-Apr-12 6:31 
AnswerRe: design of a commercial site Pin
Abhinav S17-Apr-12 7:03
Abhinav S17-Apr-12 7:03 
QuestionHow to send hashtable parameter in restful client Pin
NarVish17-Apr-12 3:56
NarVish17-Apr-12 3:56 
Questioncrystal report can be sent vai e-mail as a body Pin
narendra ingale16-Apr-12 23:54
narendra ingale16-Apr-12 23:54 
AnswerRe: crystal report can be sent vai e-mail as a body Pin
V.17-Apr-12 0:53
professionalV.17-Apr-12 0:53 
QuestionStringbuilder Pin
jeramyRR16-Apr-12 19:24
jeramyRR16-Apr-12 19:24 
AnswerRe: Stringbuilder Pin
egenis16-Apr-12 19:34
egenis16-Apr-12 19:34 
AnswerRe: Stringbuilder PinPopular
VJ Reddy16-Apr-12 19:38
VJ Reddy16-Apr-12 19:38 
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 

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.