You tagged the question to C# 4.0.
Take a look at
XElement class[
^]
With XElement you can write the same code like this:
var x = new XElement("Glyphs",
new XAttribute("Fill", "#ff000000"),
new XAttribute("FontUri", xpsFonts[0].Uri.ToString()),
new XAttribute("FontRenderingEmSize", "18"),
new XAttribute("OriginX", "120"),
new XAttribute("OriginY", "110"),
new XAttribute("UnicodeString", documentUri),
Or look at
XmlWriterSettings Class[
^]. There you can customize the writing behavior for the XmlWriter.