private void LoadDocument() { string xml = this.currentSource.GetText(); try { StringReader sr = new StringReader(xml); XmlReaderSettings settings = new XmlReaderSettings(); settings.ProhibitDtd = false; settings.IgnoreWhitespace = false; settings.CheckCharacters = false; settings.ValidationType = ValidationType.None; settings.ValidationEventHandler += new ValidationEventHandler(OnValidationEvent); XmlReader reader = XmlReader.Create(sr, settings); this.currentDomloader = new DomLoader(); using (reader) { this.currentXmlDocument = this.currentDomloader.Load(reader); } this.currentNamespaceManager = new System.Xml.XmlNamespaceManager(this.currentXmlDocument.NameTable); //if (this.currentXmlDocument.DocumentElement.NamespaceURI != string.Empty) //{ // int NewRowId = NamespaceGridView.Rows.Add(); // NamespaceGridView.Rows[NewRowId].Cells[0].Value = "ns1"; // NamespaceGridView.Rows[NewRowId].Cells[1].Value = this.currentXmlDocument.DocumentElement.NamespaceURI; //} } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex.Message); this.currentXmlDocument = null; this.currentDomloader = null; //throw; } return; }