471,326 Members | 2,432 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,326 software developers and data experts.

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

hi all,

i have a xml file.I have converted the xml file to String using
OuterXml....... now i am getting like this
</Type><Source>By client referral
</Zone><LocationInfo>ghghk jyjuy
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

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

Dec 1 '05 #1
5 2234
>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
- 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.


Dec 1 '05 #2

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)
Op.Net.Client.Temp.btnNext_Click(Object sender, EventArgs e) in
System.Web.UI.WebControls.Button.OnClick(EventArgs e)

System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
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,

Dec 1 '05 #3
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.


Dec 1 '05 #4
hi Thi,

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

with regards,

Dec 1 '05 #5
Hi Thi,

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

With Regards,

Dec 1 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Nimmi Srivastav | last post: by
reply views Thread by | last post: by
4 posts views Thread by kalio80 | last post: by
3 posts views Thread by Colin J. Williams | last post: by
3 posts views Thread by Joshua Russell | last post: by
12 posts views Thread by Adam J. Schaff | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.