using System;
using System.Xml;
using System.Xml.Linq;
public class Program
{
public static void Main()
var xml = @"<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE math:math PUBLIC '-//OpenOffice.org//DTD Modified W3C MathML 1.01//EN' 'math.dtd'>
<math:math xmlns:math='http://www.w3.org/1998/Math/MathML'>
<math:semantics>
<math:msup>
<math:mrow>
<math:mo math:stretchy='false'>(</math:mo>
<math:mi>a</math:mi>
<math:mo math:stretchy='false'>+</math:mo>
<math:mi>b</math:mi>
</math:mrow>
<math:mo math:stretchy='false'>)</math:mo>
<math:mn>2</math:mn>
</math:msup>
<math:annotation math:encoding='StarMath 5.0'>(a+b)^2</math:annotation>
</math:semantics>
</math:math>";
var doc = XDocument.Parse(xml);
doc.DocumentType.Remove();
Console.WriteLine(doc.ToString());
}