Populate XDocument from String

Populate XDocument from String

Asked on December 17, 2018 in XML.
Add Comment


  • 3 Answer(s)

    Try this link to populate XDocument from String:

         Use XDocument.Parse for populating XDocument from String.

    Answered on December 17, 2018.
    Add Comment

    Use this simplest way:

         We can use XDocument.Parse string on behalf of Load string.

    Answered on December 17, 2018.
    Add Comment

    Try this codes below:

    TextReader tr = new StringReader("<Root>Content</Root>");
    XDocument doc = XDocument.Load(tr);
    Console.WriteLine(doc);
    

         We can also use http://msdn.microsoft.com/en-us/library/bb299692.aspx  link for populating XDocument from String.

    Answered on December 17, 2018.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.