467,133 Members | 1,138 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,133 developers. It's quick & easy.

Dataset GetXML and ReadXML

Hi I have a little bit of trouble, probably missing the point now sure
but:

I have a dataset

dim ds as new dataset("User")

Which is populated with data from a database.

When I use

strXml = ds.GetXml()
strSchema = ds.GetSchema()

Then try and re-import into a data set, using the following
mXml = New
MemoryStream(Encoding.GetEncoding("UTF-16").GetBytes(strXml))
mSchema = New
MemoryStream(Encoding.GetEncoding("UTF-16").GetBytes(strSchema))

dim importDS as new DataSet("User")

importDS.ReadSchema(mschema)

importDS.ReadXml(mXml)

I find that the schema imports correctly however the the ReadXML line
throws and exception, checking the XML I can't see anything wrong with
it, as it just a direct output from getXML
[XmlException: An unexpected end of file parsing NAME has occurred.
Line 1, position 2.]
System.Xml.XmlScanner.ScanMarkup() +1360
System.Xml.XmlTextReader.ParseTag() +74
System.Xml.XmlTextReader.ParseRoot() +234
System.Xml.XmlTextReader.Read() +127
System.Xml.XmlReader.MoveToContent() +75
System.Data.DataSet.ReadXml(XmlReader reader, Boolean denyResolving)
System.Data.DataSet.ReadXml(Stream stream)

Nov 12 '05 #1
  • viewed: 5533
Share:
1 Reply
Thought I should mention I am using

Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET
Version:1.1.4322.2032
mr_dom...@hotmail.com wrote:
Hi I have a little bit of trouble, probably missing the point now sure
but:

I have a dataset

dim ds as new dataset("User")

Which is populated with data from a database.

When I use

strXml = ds.GetXml()
strSchema = ds.GetSchema()

Then try and re-import into a data set, using the following
mXml = New
MemoryStream(Encoding.GetEncoding("UTF-16").GetBytes(strXml))
mSchema = New
MemoryStream(Encoding.GetEncoding("UTF-16").GetBytes(strSchema))

dim importDS as new DataSet("User")

importDS.ReadSchema(mschema)

importDS.ReadXml(mXml)

I find that the schema imports correctly however the the ReadXML line
throws and exception, checking the XML I can't see anything wrong with
it, as it just a direct output from getXML
[XmlException: An unexpected end of file parsing NAME has occurred.
Line 1, position 2.]
System.Xml.XmlScanner.ScanMarkup() +1360
System.Xml.XmlTextReader.ParseTag() +74
System.Xml.XmlTextReader.ParseRoot() +234
System.Xml.XmlTextReader.Read() +127
System.Xml.XmlReader.MoveToContent() +75
System.Data.DataSet.ReadXml(XmlReader reader, Boolean denyResolving)
System.Data.DataSet.ReadXml(Stream stream)


Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by DotNetJunkies User | last post: by
reply views Thread by thomas@humphries.com | last post: by
reply views Thread by mr_dom_is@hotmail.com | last post: by
22 posts views Thread by Arne | last post: by
3 posts views Thread by Gene Vangampelaere | last post: by
12 posts views Thread by Marc | last post: by
3 posts views Thread by Greg Collins [Microsoft MVP] | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.