using System.Collections.Generic;
using System.Xml.Serialization;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO.Compression;
public static void Test()
var newxdoc = XDocument.Parse(GetXml());
var query = from e in newxdoc.Descendants()
let child = e.Elements().FirstOrDefault()
where child != null && child.Name.LocalName == "html"
foreach (var element in query.ToList())
var replacenode = new XElement(element.Name, element.Value);
element.ReplaceWith(replacenode);
Console.WriteLine(newxdoc);
Assert.IsTrue(!newxdoc.ToString().Contains("<html>"));
var xml = @"<?xml version=""1.0"" encoding=""utf-8""?>
<TestNodeWithNesedHtmlTags>
<html><div>test<html>OK <b>what</b> happens with nested html tags?
</html></div><html>OK what happens with nested html tags?</html></html>
</TestNodeWithNesedHtmlTags>
public static void Main()
Console.WriteLine("Roslyn 2.0 Compiler; Environment version: " + Environment.Version);
Console.WriteLine("Uncaught exception: ");