XML: Assigning a xml string to a string and load as xml document
Posted on 2011-04-19
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.
Any input is appreciated.