private void ParseRootXml(string xmlstr) { xmlDoc = new XmlDocument(); var data = new DataTable(); xmlDoc.LoadXml(xmlstr); Text = xmlDoc.LastChild.Name + " - XmlViewer"; var innerData = new InnerData(null) { data = data, xmlDoc = xmlDoc, col = -1, row = -1, xml = xmlDoc, }; curData = innerData; ParseXml(innerData); }
private void ParseRootXml(string xmlstr) { innerDataList.Clear(); xmlDoc = new XmlDocument(); var data = new DataTable(); xmlDoc.LoadXml(xmlstr); Text = xmlDoc.LastChild.Name + " - XmlViewer"; var innerData = new InnerData() { data = data, xmlDoc = xmlDoc, col = -1, row = -1, xml = xmlDoc, }; ParseXml(innerData); innerDataList.Push(innerData); }
private void saveToolStripMenuItem_Click(object sender, EventArgs e) { if (isEditMode) { tableView.EndEdit(); } if (curData.parent != null) { var innerData = curData; curData = curData.parent; curData.data.GetRow(innerData.row)[innerData.col] = innerData.UpdateChange().InnerXml; tableView.DataSource = curData.data; CheckReadOnly(); } else { curData.UpdateChange(); SaveXmlFile(); } }
private void ParseInnerXml(int col, int row, string xmlstr) { if (!IsXml(xmlstr)) { return; } var xmlDoc = new XmlDocument(); var data = new DataTable(); xmlDoc.LoadXml(" <子单元格编辑>" + xmlstr + "</子单元格编辑>"); var innerData = new InnerData() { data = data, col = col, row = row, xml = xmlDoc, xmlDoc = xmlDoc, }; ParseXml(innerData); innerDataList.Push(innerData); }
private void ParseInnerXml(int col, int row, string xmlstr) { if (!IsXml(xmlstr)) { return; } var xmlDoc = new XmlDocument(); var data = new DataTable(); xmlDoc.LoadXml(" <子单元格编辑>" + xmlstr + "</子单元格编辑>"); var innerData = new InnerData(curData) { data = data, col = col, row = row, xml = xmlDoc, xmlDoc = xmlDoc, _path = curData.data.Columns[col].ColumnName, }; curData = innerData; ParseXml(innerData); }
private void ParseXml(InnerData innerData) { var root = innerData.xml.LastChild; var colList = root.FirstChild; Loading = true; innerData.gridType = GetGridType(root); if (innerData.gridType == GridType.Grid) { int x = 0; foreach (XmlNode rowList in root.ChildNodes) { innerData.data.Rows.Add(); int y = 0; foreach (XmlNode cell in rowList.ChildNodes) { if (y == 0) { if (!innerData.data.Columns.Contains(DataTableExtend.IndexCol)) { var col = innerData.data.Columns.Add(DataTableExtend.IndexCol, typeof(int)); } innerData.data.Rows[x][DataTableExtend.IndexCol] = x; } if (!innerData.data.Columns.Contains(cell.Name)) { var col = innerData.data.Columns.Add(cell.Name); } innerData.data.Rows[x][cell.Name] = cell.InnerXml; y++; } x++; } } else { innerData.data.Columns.Add(colList.Name); int x = 0; foreach (XmlNode cell in root.ChildNodes) { int y = 0; if (!innerData.data.Columns.Contains(cell.Name)) { innerData.data.Columns.Add(cell.Name); } innerData.data.Rows.Add(); if (y == 0) { if (!innerData.data.Columns.Contains(DataTableExtend.IndexCol)) { innerData.data.Columns.Add(DataTableExtend.IndexCol, typeof(int)); } innerData.data.Rows[x][DataTableExtend.IndexCol] = x; } innerData.data.Rows[x][cell.Name] = cell.InnerXml; y++; x++; } } tableView.DataSource = innerData.data; CheckReadOnly(); tableView.Columns[DataTableExtend.IndexCol].Visible = false; Loading = false; }
public InnerData(InnerData parent) { this.parent = parent; }