Example #1
0
    /// <summary>
    /// 单独展示时解析XML
    /// </summary>
    /// <param name="fileInfo"></param>
    /// <returns></returns>
    public static List <SingleCurtain> SingleReadInfo(string fileInfo)
    {
        List <SingleCurtain> LoadList = new List <SingleCurtain>();

        System.IO.StringReader stringReader = new System.IO.StringReader(fileInfo);
        //stringReader.Read(); // 跳过 BOM
        System.Xml.XmlReader reader = System.Xml.XmlReader.Create(stringReader);
        XmlDocument          myXML  = new XmlDocument();

        myXML.LoadXml(stringReader.ReadToEnd());
        XmlElement Xmlroot = myXML.DocumentElement;

        foreach (XmlNode item in Xmlroot["stylor_list"].ChildNodes)
        {
            SingleCurtain newExcel = new SingleCurtain();
            //newExcel.IsModel = bool.Parse(item["IsModel"].InnerText);
            //newExcel.Description = item["Description"].InnerText;
            newExcel.TextureUrl  = item.Attributes["stylor_file_url"].Value;
            newExcel.Stylor_code = item.Attributes["stylor_code"].Value;
            newExcel.Name        = item.Attributes["stylor_name"].Value;
            //newExcel.Curtain_kind = item.Attributes["prod_kind"].Value;
            LoadList.Add(newExcel);
        }
        return(LoadList);
    }
Example #2
0
    // 单独展示时解析XML
    public static List <SingleCurtain> SingleReadInfo(string fileInfo)
    {
        List <SingleCurtain> LoadList = new List <SingleCurtain>();

        System.IO.StringReader stringReader = new System.IO.StringReader(fileInfo);
        stringReader.Read(); // 跳过 BOM
        System.Xml.XmlReader reader = System.Xml.XmlReader.Create(stringReader);
        XmlDocument          myXML  = new XmlDocument();

        myXML.LoadXml(stringReader.ReadToEnd());



        XmlElement Xmlroot = myXML.DocumentElement;

        foreach (XmlNode item in Xmlroot.ChildNodes)
        {
            SingleCurtain newExcel = new SingleCurtain();
            //newExcel.IsModel = bool.Parse(item["IsModel"].InnerText);
            newExcel.TextureUrl = item["TextureUrl"].InnerText;
            LoadList.Add(newExcel);
        }
        return(LoadList);
    }