String To Xml - CSharp System.Xml

CSharp examples for System.Xml:XML String

Description

String To Xml

Demo Code

// Permission is hereby granted, free of charge, to any person obtaining
using System.Xml;
using System.Globalization;
using System.Collections.Generic;
using System;//from ww w  .j  a  v a2  s . c o m

public class Main{
        public static XmlNode ToXml(this string xml)
        {
            var doc = new XmlDocument();
            var fragment = doc.CreateDocumentFragment();
            fragment.InnerXml = xml;
            doc.AppendChild(fragment);
            return doc.FirstChild;
        }
}

Related Tutorials