Load DataSet into an XML Document - C#.Net

Posted by NLV on Stack Overflow See other posts from Stack Overflow or by NLV
Published on 2010-04-19T11:47:52Z Indexed on 2010/04/19 11:53 UTC
Read the original article Hit count: 334

Filed under:
|
|

Hello

I'm trying to read a dataset as xml and load it into an XML Document.

                        XmlDocument contractHistoryXMLSchemaDoc = new XmlDocument();

                        using (MemoryStream ms = new MemoryStream())
                        {
                            //XmlWriterSettings xmlWSettings = new XmlWriterSettings();

                            //xmlWSettings.ConformanceLevel = ConformanceLevel.Auto;
                            using (XmlWriter xmlW = XmlWriter.Create(ms))
                            {
                                xmlW.WriteStartDocument();
                                dsContract.WriteXmlSchema(xmlW);
                                xmlW.WriteEndDocument();
                                xmlW.Close();
                                using (XmlReader xmlR = XmlReader.Create(ms))
                                {
                                    contractHistoryXMLSchemaDoc.Load(xmlR);
                                }
                            }

                        }

But i'm getting the error - "Root Element Missing".

Any ideas?

NLV

© Stack Overflow or respective owner

Related posts about Xml

Related posts about dataset