?
Solved

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

Posted on 2011-04-19
4
Medium Priority
?
234 Views
Last Modified: 2012-06-21
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
Comment
Question by:arvee2003
  • 2
4 Comments
 
LVL 7

Expert Comment

by:JuanCarniglia
ID: 35425400
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
 
LVL 41

Expert Comment

by:graye
ID: 35427137
I think you just had the arguments to the Replace method backwards....

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

Accepted Solution

by:
arvee2003 earned 0 total points
ID: 35778403
Resolved it myself
0
 

Author Closing Comment

by:arvee2003
ID: 35810076
None
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Screencast - Getting to Know the Pipeline
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question