This commit is contained in:
sherlockforrest
2023-06-20 09:22:53 +08:00
commit bf2ed2e31f
621 changed files with 271599 additions and 0 deletions

74
XmlParser/Teacher.cs Normal file
View File

@@ -0,0 +1,74 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;
namespace XmlParserByAttribute
{
[XmlRoot("teacher")]
public class Teacher
{
[XmlAttribute("LessonTitle")]
public string LessonTitle { get; set; }
[XmlElement("general")]
public general general { get; set; }
[XmlElement("descrption")]
public descrption descrption { get; set; }
[XmlElement("part")]
public List<part> partlist { get; set; }
}
public class general
{
[XmlAttribute("title")]//是string类型
public string title { get; set; }
[XmlAttribute("msg")]
public string msg { get; set; }
}
public class descrption
{
[XmlAttribute("document")]
public string document { get; set; }
}
public class part
{
[XmlAttribute("PartTitle")]
public string PartTitle { get; set; }
[XmlAttribute("PartNum")]
public string PartNum { get; set; }
[XmlAttribute("PartOver")]
public string PartOver { get; set; }
[XmlElement(ElementName = "sco", Type = typeof(sco), IsNullable = true)]
[XmlElement(ElementName = "quest", Type = typeof(quest), IsNullable = true)]
public List<kk> kks { get; set; }
}
//part内有两个节点为了合并到一个合集里声明父类kk用以合并两个子类到一个合集里
public class kk
{
}
public class quest : kk
{
[XmlAttribute("Title")]
public string Title { get; set; }
}
public class sco : kk
{
[XmlAttribute("ScoTitle")]
public string ScoTitle { get; set; }
[XmlAttribute("isok")]
public string isok { get; set; }
}
}