AwaireVoitoro
New Member
The app should add the nodes from time to time to Goals.xml" file. So its dynamic. The code that adds the nodes:\[code\]XmlWriterSettings settings=new XmlWriterSettings(); settings.OmitXmlDeclaration= true;settings.Indent = true;settings.IndentChars = ("\t");using (IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())using (IsolatedStorageFileStream stream = myIsolatedStorage.OpenFile("Goals.xml", FileMode.Append)){ XmlSerializer serializer = new XmlSerializer(typeof(List<Goals>)); using (XmlWriter xmlWriter = XmlWriter.Create(stream, settings)) { serializer.Serialize(xmlWriter, GenerateGoalsData(name, description, progress)); }}\[/code\]and\[code\]private List<Goals> GenerateGoalsData(string name, string description, string progress){ List<Goals> data = http://stackoverflow.com/questions/12341192/new List<Goals>(); data.Add(new Goals() { Name=name, Description=description, Progress=progress}); return data;}\[/code\]and also i have class Goals. But it generates bad XML:\[code\]<ArrayOfGoals xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Goals> <Name>Jack</Name> <Description>lalala</Description> <Progress>97</Progress> </Goals></ArrayOfGoals><ArrayOfGoals xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Goals> <Name>Taaaaaa</Name> <Description>nanana</Description> <Progress>50</Progress> </Goals></ArrayOfGoals>\[/code\]How to remove in XML the repeated:\[code\]</ArrayOfGoals><ArrayOfGoals xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">\[/code\]so the XML looks like that:\[code\] <ArrayOfGoals xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Goals> <Name>Jack</Name> <Description>lalala</Description> <Progress>97</Progress> </Goals> <Goals> <Name>Taaaaaa</Name> <Description>nanana</Description> <Progress>50</Progress> </Goals> </ArrayOfGoals>\[/code\]Or how to append the nodes without that string being automatically added?