To convert xml string to XmlNode in C# and VB.NET you can use the following snippet.
Sample C#
public static XmlNode XmlStringToXmlNode(string xmlInputString) { if (String.IsNullOrEmpty(xmlInputString.Trim())) { throw new ArgumentNullException("xmlInputString"); } var xd = new XmlDocument(); using (var sr = new StringReader(xmlInputString)) { xd.Load(sr); } return xd; }
Sample VB.NET
Public Shared Function XmlStringToXmlNode(xmlInputString As String) As XmlNode If String.IsNullOrEmpty(xmlInputString.Trim()) Then Throw New ArgumentNullException("xmlInputString") End If Dim xd = New XmlDocument() Using sr = New StringReader(xmlInputString) xd.Load(sr) End Using Return xd End Function
RT @CodeSnippetsNET: How to convert #xml string to XmlNode in C# and #VB .NET http://t.co/rS0zd9Gq9g #csharp #visualbasic #dotnet
RT @CodeSnippetsNET: How to convert #xml string to XmlNode in C# and #VB .NET http://t.co/rS0zd9Gq9g #csharp #visualbasic #dotnet
RT @CodeSnippetsNET: How to convert #xml string to XmlNode in C# and #VB .NET http://t.co/rS0zd9Gq9g #csharp #visualbasic #dotnet