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

Posted on 2011-04-19
Last Modified: 2012-06-21

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.

Question by:arvee2003
    LVL 7

    Expert Comment

    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>"

    LVL 41

    Expert Comment

    I think you just had the arguments to the Replace method backwards....

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

    Accepted Solution

    Resolved it myself

    Author Closing Comment


    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    Introduction In my previous article ( I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    755 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

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now