zoukankan      html  css  js  c++  java
  • xelement 转 List

    List<SwipeCardData> CardDataList = new List<SwipeCardData>();
    //返回是xelement的集合,首先获得真正的表的节点。使用Nodes.Descendants("Table"),获得指定标签,然后foreach遍历
    foreach (XElement el in result.Nodes.Descendants("Table"))
    {
    SwipeCardData CardData = new SwipeCardData();
    //根据节点循环赋值给SwipeCardData类
    foreach (XElement ell in el.Nodes())
    {
    switch (Convert.ToString(ell.Name))
    {
    case "LineID":
    CardData.ProcessID = ell.Value != "" ? Convert.ToInt32(ell.Value) : 0;
    break;
    case "LineDesc":
    CardData.ProcessName = ell.Value;
    break;
    case "StationID":
    CardData.StationID = ell.Value != "" ? Convert.ToInt32(ell.Value) : 0;
    break;
    case "StationDesc":
    CardData.StationNmae = ell.Value;
    break;
    case "UserID":
    CardData.EmployeeNum = ell.Value;
    break;
    case "UserName":
    CardData.EmployeeName = ell.Value;
    break;
    case "StatusDesc":
    CardData.type = ell.Value != "" ? ell.Value : "";
    break;
    case "RecordTime":
    CardData.AtWork = Convert.ToDateTime(ell.Value).ToString("yyyy-MM-dd HH:mm:ss.fff");
    break;
    case "ID":
    CardData.Id = Guid.NewGuid();
    break;
    default:
    break;
    }
    }
    //添加到数组中
    CardDataList.Add(CardData);
    }
  • 相关阅读:
    nginx--gunicorn 部署Web服务
    Hexo 搭建博客真的太简单了
    nohup 和 &
    Nginx 服务器搭建
    Django3 的服务器搭建
    Mongo 服务器的安装
    Ubuntu16.04 安装tesseract
    phantomjs 的安装
    JsonPath python
    CSS 选择器:BeautifulSoup4
  • 原文地址:https://www.cnblogs.com/LinWenQiang/p/14892416.html
Copyright © 2011-2022 走看看