XmlDocument doc = new XmlDocument(); XmlElement root = doc.CreateElement("root"); doc.AppendChild(root);
XmlElement child = doc.CreateElement("child"); root.AppendChild(child);These examples use the XmlDocument class from the System.Xml namespace, which is part of the .NET framework.