asp.net读取XML文件后怎么执行分页啊谢谢

解决方案 »

  1.   

    你需要使用xpath过滤数据,或者遍历xml,将部分数据保存在另外一个xml 对象中
      

  2.   

    例子
    System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
    doc.LoadXml("<items/>");
    for (int i = 0; i < 100; i++)
    {
      System.Xml.XmlNode node = doc.CreateNode(System.Xml.XmlNodeType.Element, "item", null);
      node.InnerText = i.ToString();
      doc.DocumentElement.AppendChild(node);          
    }
    //doc.Save(Server.MapPath("data.xml"));System.Xml.XmlNodeList nodes = doc.SelectNodes("/items/item[position() > 10 and position() < 20 ]");
    foreach (System.Xml.XmlNode n in nodes)
    {
      Response.Write(n.InnerText);
    }