Parse XML into accordion/treeview

I deserialized the xml. See if you can create the treeview yourself from the classes

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Serialization;

namespace ConsoleApplication9
{
    class Program
    {
        static string FILENAME = @"c:\temp\test.xml";
        static void Main(string[] args)
        {
            XmlReader reader = XmlReader.Create(FILENAME);
            XmlSerializer serializer = new XmlSerializer(typeof(VersionHistory));
            VersionHistory versionHistory = (VersionHistory)serializer.Deserialize(reader);
        }
    }
    public class VersionHistory
    {
        [XmlElement("version")]
        public List<Version> versions { get; set; }
    }
    public class Version
    {
        [XmlAttribute("VersionID")]
        public string id { get; set; }

        public string CCNumber { get; set; }

        public string Description { get; set; }

        [XmlElement("Changes")]
        public List<Changes> changes { get; set; }
    }
    public class Changes
    {
        [XmlAttribute()]
        public int id { get; set; }

        [XmlAttribute()]
        public string note { get; set; }

        [XmlText]
        public string value { get; set; }
    }
}

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top