By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,502 Members | 1,177 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,502 IT Pros & Developers. It's quick & easy.

problem in XML file while converting to string........

P: n/a
hi all,

i have a xml file.I have converted the xml file to String using
OuterXml....... now i am getting like this
"<ClientList><Client
action=\"Modify\"><ClientID>nokia</ClientID><FullName>Raj</FullName><AccountNo>12345</AccountNo><Type>Individual
</Type><Source>By client referral
</Source><Status>Bad
</Status><Industry>Marketing
</Industry><Info><![CDATA[Some
Text]]></Info><Logo></Logo><ClientAdditionalInfo><ClientId></ClientId><Text1></Text1><Text2></Text2><Text3></Text3><Text4></Text4><Text5></Text5><Text6></Text6><Text7></Text7><Text8></Text8><Text9></Text9><Text10></Text10></ClientAdditionalInfo><AddressList><Address
action=\"add\"><FirstName>sam</FirstName><Street>343,fddf,fdf,\r\ndfd</Street><State>hghghg</State><City>fdf</City><Country>China</Country><PostCode>kui</PostCode><Zone>100
</Zone><LocationInfo>ghghk jyjuy
yjyj</LocationInfo><Remark>hjgghghghg</Remark><XMapPos></XMapPos><YMapPos></YMapPos><XRtPos></XRtPos><YBotPos></YBotPos><ContactList><ContactInfo
action=\"add\"><ContactId></ContactId><ContactIdType>Name</ContactIdType><ContactFor>Address</ContactFor><ForId>3A6D7D9A48F84A64A4B451A3B7771158 </ForId><ContactName></ContactName><ContactNo>23232354545</ContactNo></ContactInfo><ContactInfo
action=\"add\"><ContactId></ContactId><ContactIdType>Phone</ContactIdType><ContactFor>Address</ContactFor><ForId>3A6D7D9A48F84A64A4B451A3B7771158 </ForId><ContactName></ContactName><ContactNo>23232354545</ContactNo></ContactInfo><ContactInfo
action=\"add\"><ContactId></ContactId><ContactIdType>Cellular</ContactIdType><ContactFor>Address</ContactFor><ForId>3A6D7D9A48F84A64A4B451A3B7771158 </ForId><ContactName></ContactName><ContactNo>23232354545</ContactNo></ContactInfo><ContactInfo
action=\"add\"><ContactId></ContactId><ContactIdType>Email</ContactIdType><ContactFor>Address</ContactFor><ForId>3A6D7D9A48F84A64A4B451A3B7771158 </ForId><ContactName></ContactName><ContactNo>23232354545</ContactNo></ContactInfo></ContactList></Address></AddressList></Client></ClientList>"
i want to remove those backslash and double quotes which appear in
action tag(like <Client action =\"Modify\">) in the xml........ plz
help to solve this problem.....
how can i do that ....... i searched for ascii function in C# but found
nothing......

pls help me to solve the problem....
Thanking you in advance.....
with regards,
Sridev

Dec 1 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
>i want to remove those backslash and double quotes which appear in
action tag(like <Client action =\"Modify\">) in the xml........ plz

- you cannot remove the double quotes, or you will make the xml
illformed
- the OuterXml does not contain backslashes. You only see backslashes
in debugger's windows (like Watch or Command). These windows display
values as they are declared in code. It already includes double quotes
arround the string, so it add backslashes for embeded double quotes for
the sake of clarification.

Thi

Dec 1 '05 #2

P: n/a
hi,

Thank you Truong for your solution......... Actually i want it to
remove because i am storing the string into database using COM which
was written in VC++.When i give the string to the COM for saving the
string into database it generates error like this

Exception Details: System.Runtime.InteropServices.COMException:
Exception from HRESULT: 0x80040E14.

Source Error:
Line 475:
Line 476:
String strClientxml="";

Note: Line 477: strClientxml=objClient.Save(strCondb,strXml);
// error in this line

Line 478: Debug.WriteLine(strClientxml);
Line 479: }
Source File: e:\optimate.net\client\insclient.aspx.cs Line: 477

Stack Trace:
[COMException (0x80040e14): Exception from HRESULT: 0x80040E14.]
SPSCOMLib.DCOMClientClass.Save(String bstrConnString, String strXML)
+0
Op.Net.Client.Temp.btnNext_Click(Object sender, EventArgs e) in
e:\op.net\client\insclient.aspx.cs:477
System.Web.UI.WebControls.Button.OnClick(EventArgs e)

System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String
eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
System.Web.UI.Page.ProcessRequestMain()
So i thought that because of that backslah and double quotes its not
getting saved.............. If you know the solution for this plz let
me know that...........

Thank you once again.......

with regards,
Sridev

Dec 1 '05 #3

P: n/a
There should be a problem with your COM's Save method.
In .NET, you should use parameter instead of string concatenation to
ensure the xml string be escaped correctly.
I am not sure about VC++, but you may need to make use of something
similar to ensure the xml text is sanitized.

Thi

Dec 1 '05 #4

P: n/a
hi Thi,

Thank you for ur solution..........

with regards,
Sridev

Dec 1 '05 #5

P: n/a
Hi Thi,

I got the result ......... Thank you for ur great help.

With Regards,
Sridev

Dec 1 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.