/// <summary> /// This function wraps the model class to an xml form /// </summary> /// <param name="model">The model class to be wrapped</param> /// <returns>A string representing the model class</returns> public string InfoModelToXML(InfoModel model) { StringBuilder sb = new StringBuilder(); XmlWriterSettings settings = new XmlWriterSettings(); XmlWriter writer = XmlWriter.Create(sb, settings); writer.WriteStartDocument(); writer.WriteStartElement("InfoModels"); model.ToXml(writer); writer.WriteEndElement(); writer.WriteEndDocument(); writer.Flush(); return(sb.ToString()); }
private string ToXml(InfoModel position) { //Initiate XML stuff StringBuilder sb = new StringBuilder(); XmlWriterSettings settings = new XmlWriterSettings(); XmlWriter writer = XmlWriter.Create(sb, settings); writer.WriteStartDocument(); writer.WriteStartElement("positions"); position.ToXml(writer); writer.WriteEndElement(); writer.WriteEndDocument(); writer.Flush(); return(sb.ToString()); }
private void ToXml(InfoModel fd, string path) { //Initiate XML stuff XmlWriterSettings settings = new XmlWriterSettings(); settings.Indent = true; settings.NewLineOnAttributes = true; XmlWriter writer = XmlWriter.Create(path, settings); writer.WriteStartDocument(); writer.WriteStartElement("Datas"); fd.ToXml(writer); writer.WriteEndElement(); writer.WriteEndDocument(); writer.Flush(); writer.Close(); }