1)
I'm not sure where they are coming from but its definitely made when i create the file.
I thought i was creating the xml correctly but now im not so sure
I assume that this is being created at line 9 but im not sure.
C# Code:
XmlDocument xmlDoc = new XmlDocument(); if (File.Exists(path)) { File.Delete(path); } //if file is not found, create a new xml file XmlTextWriter xmlWriter = new XmlTextWriter(path, System.Text.Encoding.UTF8); xmlWriter.Formatting = Formatting.Indented; xmlWriter.WriteProcessingInstruction("xml", "version='1.0' encoding='UTF-8'"); xmlWriter.WriteStartElement("Root"); xmlWriter.Close(); xmlDoc.Load(path); XmlNode root = xmlDoc.DocumentElement; XmlElement fileInfo = xmlDoc.CreateElement("FileInfo"); XmlElement MatchInfo = xmlDoc.CreateElement("MatchInfo"); XmlElement TeamInfo = xmlDoc.CreateElement("TeamInfo"); MatchInfo.SetAttribute("Headline", TB_Headline_o.Text); MatchInfo.SetAttribute("R1Title", TB_R1_Title_o.Text); MatchInfo.SetAttribute("R2Title", TB_R2_Title_o.Text); MatchInfo.SetAttribute("R3Title", TB_R3_Title_o.Text); MatchInfo.SetAttribute("R4Title", TB_R4_Title_o.Text); XmlElement TourName = xmlDoc.CreateElement("TourName"); XmlElement Username = xmlDoc.CreateElement("Username"); XmlElement Timestamp = xmlDoc.CreateElement("timestamp"); XmlElement Title = xmlDoc.CreateElement("Region"); (Cutting out alot of the middle stuff) root.AppendChild(fileInfo); root.AppendChild(MatchInfo); root.AppendChild(TeamInfo); xmlDoc.Save(path); MessageBox.Show("File Saved!");





Reply With Quote