I´m trying to add the following element to a .XML on C#:
<Launch.Addon>
<Name>IvAp</Name>
<Disabled>False</Disabled>
<Path>C:\Program Files (x86)</Path>
<Commandline></Commandline>
</Launch.Addon>
With the following code:
XDocument xd1 = new XDocument();
xd1 = XDocument.Load(pathToAData + "\\dll.xml");
XElement root = new XElement("Launch Addon");
root.Add(new XElement("Name", "IvAp"));
root.Add(new XElement("Disable", "False"));
root.Add(new XElement("Path", "C:\\Program Files (x86)\\IVAO\\IvAp v2\\ivap_fsx_bootstrap.dll"));
root.Add(new XElement("Commandline"));
xd1.Element("Launch Addon").Add(root);
xd1.Save(pathToAData + "\\dll.xml");
But it throws an error in try {} catch {} block, I´ll be very thankful if you can help me
This is the error:
.System.Xml.XmlException: El carácter ' ', con valor hexadecimal 0x20, no puede incluirse en un nombre.