XML > ArrayList > ListBox

// 创建XmlDocument类的实例
   XmlDocument doc = new XmlDocument();
   ArrayList NodeValues = new ArrayList();
   // 把people.xml文件读入内存,形成一个DOM结构
   doc.Load( Server.MapPath("people.xml") );
   XmlNode root = doc.DocumentElement;
   foreach( XmlNode personElement in root.ChildNodes )
    //NodeValues.Add(personElement.FirstChild.Value);
    NodeValues.Add(personElement.InnerText);

   XMLNodeListBox.DataSource = NodeValues;
   XMLNodeListBox.DataBind();

<?xml version="1.0" encoding="utf-8" ?>
  <PEOPLE>
    <PERSON>张三</PERSON>
    <PERSON>李四</PERSON>
  </PEOPLE>

原文地址:https://www.cnblogs.com/RobotTech/p/537039.html