internal void LoadData(XmlDocument xdoc) { if (xdoc.DocumentElement != null) { bool enforceConstraints; if (this.isTableLevel) { enforceConstraints = this.dataTable.EnforceConstraints; this.dataTable.EnforceConstraints = false; } else { enforceConstraints = this.dataSet.EnforceConstraints; this.dataSet.EnforceConstraints = false; this.dataSet.fInReadXml = true; } if (this.isTableLevel) { this.nodeToSchemaMap = new XmlToDatasetMap(this.dataTable, xdoc.NameTable); } else { this.nodeToSchemaMap = new XmlToDatasetMap(this.dataSet, xdoc.NameTable); } DataRow row = null; if (this.isTableLevel || ((this.dataSet != null) && this.dataSet.fTopLevelTable)) { XmlElement documentElement = xdoc.DocumentElement; DataTable schemaForNode = (DataTable)this.nodeToSchemaMap.GetSchemaForNode(documentElement, this.FIgnoreNamespace(documentElement)); if (schemaForNode != null) { row = schemaForNode.CreateEmptyRow(); this.nodeToRowMap[documentElement] = row; this.LoadRowData(row, documentElement); schemaForNode.Rows.Add(row); } } this.LoadRows(row, xdoc.DocumentElement); this.AttachRows(row, xdoc.DocumentElement); if (this.isTableLevel) { this.dataTable.EnforceConstraints = enforceConstraints; } else { this.dataSet.fInReadXml = false; this.dataSet.EnforceConstraints = enforceConstraints; } } }