示例#1
0
        public ODDataSet(string xmlData)
        {
            Tables = new ODDataTableCollection();
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(xmlData);
            ODDataTable currentTable = new ODDataTable();
            ODDataRow   currentRow;
            XmlNodeList nodesRows = doc.DocumentElement.ChildNodes;

            for (int i = 0; i < nodesRows.Count; i++)
            {
                currentRow = new ODDataRow();
                if (currentTable.Name == "")
                {
                    currentTable.Name = nodesRows[i].Name;
                }
                else if (currentTable.Name != nodesRows[i].Name)
                {
                    this.Tables.Add(currentTable);
                    currentTable      = new ODDataTable();
                    currentTable.Name = nodesRows[i].Name;
                }
                foreach (XmlNode nodeCell in nodesRows[i].ChildNodes)
                {
                    currentRow.Add(nodeCell.Name, nodeCell.InnerXml);
                }
                currentTable.Rows.Add(currentRow);
            }
            this.Tables.Add(currentTable);
        }
示例#2
0
        public ODDataTable(string xmlData)
        {
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(xmlData);
            Rows = new List <ODDataRow>();
            Name = "";
            ODDataRow   currentRow;
            XmlNodeList nodesRows = doc.DocumentElement.ChildNodes;

            for (int i = 0; i < nodesRows.Count; i++)
            {
                currentRow = new ODDataRow();
                if (Name == "")
                {
                    Name = nodesRows[i].Name;
                }
                foreach (XmlNode nodeCell in nodesRows[i].ChildNodes)
                {
                    currentRow.Add(nodeCell.Name.ToString(), nodeCell.InnerXml);
                }
                Rows.Add(currentRow);
            }
        }