Skip to content

Instantly share code, notes, and snippets.

@Microsofttechies
Created April 3, 2015 17:13
Show Gist options
  • Select an option

  • Save Microsofttechies/37b2dd3103f98fc3f490 to your computer and use it in GitHub Desktop.

Select an option

Save Microsofttechies/37b2dd3103f98fc3f490 to your computer and use it in GitHub Desktop.
C# XML read and remove namespace
XmlDocument xmlD = new XmlDocument();
xmlD.Load("C:\\a.xml");
string strxml = xmlD.OuterXml.ToString();
Regex regEx = new Regex(@"< \?xml.*?\?>");
strxml = regEx.Replace(strxml, " ");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment