Read a dataset from a stream

T

Todd A

Does anyone have a method up their sleeve to read a DataSet from a Stream?
I see that the DataSet.ReadXML(stream) is not supported in the .NET CF.

The dataset I am trying to read is on the PPC file system, but it is
encrypted.
I retreive the file, decrypt it, and now have the "text" of the xml in a
string/stream variable.

I would now like to read this string/stream variable into a new dataset.

I know I could rewrite the decrypted XML to the file system, and read it
from there, but I am trying to avoid leaving any hint of decrypted data on
the file system.

I've tried using an XMLReader, but can't seem to locate the correct method
and or sequence of events to get it into a dataset. I do get an error that
reads:

"This is an unexpected token. The expected toekn is 'NAME. Line 1, position
2."

The XML in the stream/string includes it's schema. The XML consists of
two(2) tables with one relationship between them. (parent key/foreign key)

I can use either a string or a stream for this task.

Thank you,

Todd Acheson
 
I

Ilya Tumanov [MS]

You need to use DataSet.ReadXml(XmlReader reader) overload. Create a new
instance of XmlTextReader to pass to ReadXml() with the following overload:
XmlTextReader(Stream input).
Should you get an exception for valid XML, make sure data is decrypted
correctly.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
 
T

Todd A

Ilya,
Thanks for the hint. It put me on the right path. My mistake was actually
encoding my bytes into Unicode instead of ASCII from the decrypted string.

Thanks,

Todd Acheson


"Ilya Tumanov [MS]" said:
You need to use DataSet.ReadXml(XmlReader reader) overload. Create a new
instance of XmlTextReader to pass to ReadXml() with the following overload:
XmlTextReader(Stream input).
Should you get an exception for valid XML, make sure data is decrypted
correctly.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: "Todd A" <[email protected]>
Subject: Read a dataset from a stream
Date: Tue, 21 Dec 2004 15:51:13 -0600
Lines: 31
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: samaha1.gofast.net 206.147.205.226
Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10
phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.compactframework:67365
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

Does anyone have a method up their sleeve to read a DataSet from a Stream?
I see that the DataSet.ReadXML(stream) is not supported in the .NET CF.

The dataset I am trying to read is on the PPC file system, but it is
encrypted.
I retreive the file, decrypt it, and now have the "text" of the xml in a
string/stream variable.

I would now like to read this string/stream variable into a new dataset.

I know I could rewrite the decrypted XML to the file system, and read it
from there, but I am trying to avoid leaving any hint of decrypted data on
the file system.

I've tried using an XMLReader, but can't seem to locate the correct method
and or sequence of events to get it into a dataset. I do get an error that
reads:

"This is an unexpected token. The expected toekn is 'NAME. Line 1, position
2."

The XML in the stream/string includes it's schema. The XML consists of
two(2) tables with one relationship between them. (parent key/foreign key)

I can use either a string or a stream for this task.

Thank you,

Todd Acheson
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top