• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 238
  • Last Modified:

XML: Assigning a xml string to a string and load as xml document

Hi,

In a table the xml is stored as a string in a  column xmlvalue.

xmlvalue =  "<?xml version='1.0'?><Session><Username>Johnw</Username><id>3456</id></Session>"

when I read the above

string xmlString = xmlvalue;

It does not store the value, because of  version="1.0" has double quotes.

I need some how either to replace the version with blank or replace " with '.

I tried the following but it does not work. It just returns the column name (xmlvalue)

 xmlString =xmlvalue.Replace("\"", "'");

I need to get the xmlstring and load it as a xmldocument and read the nodes. If the version="1.0" has single quotes it works.

xDoc.LoadXml(xmlString);

Any input is appreciated.

THanks
Suresh
0
arvee2003
Asked:
arvee2003
  • 2
1 Solution
 
JuanCarnigliaCommented:
Double quotes on ASP are escaped using double double quotes.

For instance.

xmlvalue =  "<?xml version=""1.0""?><Session><Username>Johnw</Username><id>3456</id></Session>"

Greetings.
0
 
grayeCommented:
I think you just had the arguments to the Replace method backwards....

xmlString =xmlvalue.Replace("'", "\"");
0
 
arvee2003Author Commented:
Resolved it myself
0
 
arvee2003Author Commented:
None
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now