Check out example codes for "how to create xml file in c#". It will help you in understanding the concepts better.

Code Example 1

private XmlElement CreateLicenseKeyValuePairNodes(XmlDocument document)
        {

            XmlElement keyValueElement = document.CreateElement("KeyValuePair");
            XmlElement keyElement = document.CreateElement("Key");
            XmlElement valueElement = document.CreateElement("Value");

            keyValueElement.AppendChild(keyElement);
            keyValueElement.AppendChild(valueElement);

            return keyValueElement;
        }


        protected virtual void CreateXmlDoc(int count)
        {
            XmlDocument outputDocument = new XmlDocument();
            XmlElement rootElement = outputDocument.CreateElement("Base");
            XmlElement customerElement = outputDocument.CreateElement("Customer");
            XmlElement projectElement = outputDocument.CreateElement("Project");
            XmlElement programIdElement = outputDocument.CreateElement("ProgramID");
            XmlElement activationIdElement = outputDocument.CreateElement("ActivationID");
            XmlElement featureElement = outputDocument.CreateElement("Features");


            XmlElement releaseElement = outputDocument.CreateElement("ReleaseDate");
            XmlElement validationElement = outputDocument.CreateElement("ValidUntil");
            rootElement.SetAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
            rootElement.SetAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema");

            rootElement.AppendChild(customerElement);
            rootElement.AppendChild(projectElement);
            rootElement.AppendChild(programIdElement);
            rootElement.AppendChild(activationIdElement);
            rootElement.AppendChild(featureElement);

            for (int i = 0; i < count; i++)
            {
                featureElement.AppendChild(CreateLicenseKeyValuePairNodes(outputDocument));
            }

            rootElement.AppendChild(releaseElement);
            rootElement.AppendChild(validationElement);
            outputDocument.AppendChild(rootElement);

            outputDocument.Save(@".\Template.xml");
        }

Code Example 2

new XDocument(
    new XElement("root", 
        new XElement("someNode", "someValue")    
    )
)
.Save("foo.xml");

Learn ReactJs, React Native from akashmittal.com