Experts,
I am trying xml serialization using c# and the final xml i get contains lot of escape and formatting characters, i need a clean xml ,how do i get this ,i tried setting the encoding format with no use. pls reply.
sample xml after serialization given - i want to remove the \, \r,\n. I may say string.replace() after getting the xml , but is therre any way to specify it in the xmlserializer???
<?xml version=\"1.0\"?>\r\n<AirAvailability_6_2>\r\n <AirAvailMods>\r\n <AirVPrefInd>\r\n <AirVIncExcInd>I</AirVIncExcInd>\r\n <RelaxAirVPref>N</RelaxAirVPref>\r\n </AirVPrefInd>\r\n <AirVPrefs>\r\n <AirVAry>\r\n <AirVInfo>\r\n <AirV>EK</AirV>\r\n </AirVInfo>\r\n </AirVAry>\r\n </AirVPrefs>\r\n <GenAvail>\r\n <NumSeats>2</NumSeats>\r\n <Class>Y</Class>\r\n <StartDt>20041201</StartDt>\r\n <StartPt>DXB</StartPt>\r\n <EndPt>LHR</EndPt>\r\n <TmWndInd>D</TmWndInd>\r\n <EndTmWnd>2330</EndTmWnd>\r\n <JrnyTm />\r\n <FltTypeInd />\r\n <FltTypePref />\r\n <StartPtInd />\r\n <EndPtInd />\r\n </GenAvail>\r\n <ConxPrefInd>\r\n <IncExc>I</IncExc>\r\n </ConxPrefInd>\r\n <ConxPref>\r\n <PtAry>\r\n <PtInfo>\r\n <Pt>LHR</Pt>\r\n </PtInfo>\r\n <PtInfo>\r\n <Pt>LCY</Pt>\r\n </PtInfo>\r\n </PtAry>\r\n </ConxPref>\r\n </AirAvailMods>\r\n</AirAvailability_6_2>
and finally, how do i replace \ in the string <?xml version=\"1.0\"?> with spaces (<?xml version="1.0"?>). I tried string.replace("\\","") doesnt work, any idea?
Thanks
Sree
string inString = "Whatever";
string out1 = Regex.Replace( inString, @"\r\n" );
string outString = (Regex.Replace( out1, @"\" );
Then check outString... note that if you check this in the debug environmnet you WILL see the " escaped with a \ , so you will need to spit it to the console or a message box.