// Comment
//create XML
XmlDocument doc = new XmlDocument();
//header
XmlDeclaration decl = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
doc.AppendChild(decl);
//
doc.Schemas.Add("test:schema:v1", "http://sample.com/schema.xsd");
XmlElement decElem = doc.CreateElement("root");
XmlAttribute attr = doc.CreateAttribute("xsi", "schemaLocation", "http://www.w3.org/2001/XMLSchema-instance");
attr.Value = "test:schema:v1 schema.xsd";
decElem .Attributes.Append(attr);
decElem .SetAttribute("xmlns", "decElem");
doc.AppendChild(docElem);