Need some help manipulating a string in C#?

nikosb

New Member
I have a very large string that I am trying to convert from an old standard to marc21 xml standard.The following line of code:\[code\]temp1 = inputString.Replace("<marc:controlfield tag=\"LDR\">", "<marc:leader>");\[/code\]Produces the following:\[code\]<marc:leader>^^^^^nam^a22^^^^^3a^4500</marc:controlfield>\[/code\]The problem is quite evident.I perform a blanket conversion on a particular term and replace it with 'marc:controlfield'. Towards the end of my conversion process, I start to handle the leader element. Which is where I am right now. The xml savvy of out there know that:\[code\]</marc:controlfield>\[/code\]needs to be:\[code\]</marc:leader>\[/code\]Once this is done, my string can be tested for well formedness and validity and etc. I am struggling on how to grab the closing brackets for a leader element and replace it with xml as shown above.Originally the Leader element looks like:\[code\]<fixfield id="LDR">^^^^^nam^a22^^^^^3a^4500</fixfield>\[/code\]Any help is greatly appreciated.
 
Back
Top