G
Guest
I have a string that contains the \", \t, \r, \n. I need to get the xml.
sample below:
"<?xml version=\"1.0\"?>\r\n<USERS
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xmlns=\"http://www.slcorp.com\\xml\\slcorp_dtd_schema.xml\">\r\n\t<ACCT>GameTek</ACCT>\r\n\t<USER>\r\n\t\t<USER_ID>Mike</USER_ID></USER>\r\n\t</USERS>\r\n"
I have tried replacing as follows so I can get the xml. I have tried 2
approaches
(1)
str = str.Replace("\n", "").Replace("\t","").Replace("\r","").Replace("\"",
""");
This code segment (Replace("\"", """) does not compile, the rest is okay.
-------------------------------------------------------------------------
(2)
I have also tried using Regex as follows
string str= Regex.Unescape(str); This time the exception is "Insufficient
hexadecimal digits"
Any ideas?
sample below:
"<?xml version=\"1.0\"?>\r\n<USERS
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xmlns=\"http://www.slcorp.com\\xml\\slcorp_dtd_schema.xml\">\r\n\t<ACCT>GameTek</ACCT>\r\n\t<USER>\r\n\t\t<USER_ID>Mike</USER_ID></USER>\r\n\t</USERS>\r\n"
I have tried replacing as follows so I can get the xml. I have tried 2
approaches
(1)
str = str.Replace("\n", "").Replace("\t","").Replace("\r","").Replace("\"",
""");
This code segment (Replace("\"", """) does not compile, the rest is okay.
-------------------------------------------------------------------------
(2)
I have also tried using Regex as follows
string str= Regex.Unescape(str); This time the exception is "Insufficient
hexadecimal digits"
Any ideas?