예제 #1
0
        /// <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());
        }
예제 #2
0
        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());
        }
예제 #3
0
        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();
        }