I create a new document, create a document element, then I create a child element. I assign the child's innerxml = to the schema. So far, so good.
I then create an XML string by getting the document's outerxml and pass that along to a new document. I do a LoadXML on the new document and that is where it fails. Test Code. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.SqlDataAdapter1.Fill(Me.DataSet11) Me.TextBox1.Text = Me.DataSet11.GetXmlSchema End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim Doc As New Xml.XmlDocument(), N As Xml.XmlNode N = Doc.CreateElement("CE") Doc.AppendChild(N) N = Doc.CreateElement("Changed") Doc.DocumentElement.AppendChild(N) N.InnerXml = Me.TextBox1.Text Dim s As String = Doc.OuterXml Dim Doc2 As New Xml.XmlDocument() Doc2.LoadXml(s) End Sub Error. An unhandled exception of type 'System.Xml.XmlException' occurred in system.xml.dll Additional information: System error. -----Original Message----- From: Prabhu, Neelesh (CAP, CARD, KPMG Consulting) [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 01, 2002 10:44 AM To: [EMAIL PROTECTED] Subject: Re: [DOTNET] Schema from Dataset The first line is perfectly legal and called a processing instruction in XML. Please provide details on how you are trying to load this document in the node of the xmldocument Thanks <Neelesh/> -----Original Message----- From: franklin gray [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 01, 2002 11:37 AM To: [EMAIL PROTECTED] Subject: [DOTNET] Schema from Dataset I am trying to load a schema from a dataset into a node of an xmldocument. If I remove the first line of the text below, it will load. I am not an XML expert but from what I know, the first line doesn't seem to be a well formated xml node and that is why loading it into an XMLElement fails. So, other then removing the first line, any other ideas? If not, any good ideas on how to remove this line without me getting burned when ADO.net starts creating a different schema? So far, the best idea I have to remove the first line is search for the first ">" and parse from there. <?xml version="1.0" encoding="utf-16"?> <xs:schema id="DataSet1" targetNamespace="http://www.tempuri.org/DataSet1.xsd" xmlns:mstns="http://www.tempuri.org/DataSet1.xsd" xmlns="http://www.tempuri.org/DataSet1.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.