ReadXML in memory

F

Fabiano

Please,

i've created a webservice that receives a XML string that i need to work as
a Dataset.

I've tryied the ReadXML method from the DataSet. First i write the XML
string at the disk and then read it, but i think it's another way to do this
in memory, using MemoryStream or other object.

No sucess.

Any idea as how i can do this?

tks in adv.

Fabiano
 
D

Dmitriy Lapshin [C# / .NET MVP]

Hi,

You can configure a TextReader or an XmlReader instance to read from a
memory stream, and then supply this instance to the appropriate ReadXML
overload.
 
F

Fabiano

Ok,

but how to use the memorystream.... do you have any sample?

Tks

Dmitriy Lapshin said:
Hi,

You can configure a TextReader or an XmlReader instance to read from a
memory stream, and then supply this instance to the appropriate ReadXML
overload.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://www.x-unity.net/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

Fabiano said:
Please,

i've created a webservice that receives a XML string that i need to work as
a Dataset.

I've tryied the ReadXML method from the DataSet. First i write the XML
string at the disk and then read it, but i think it's another way to do this
in memory, using MemoryStream or other object.

No sucess.

Any idea as how i can do this?

tks in adv.

Fabiano
 
L

Lafayette

what about XmlTextWriter?
in my books says:
" allows you write out XML to a stream,file or textWriter objects"
you can try write to a memory stream and then read the data in memory stream
using XmlTextReader.
after this, you call the ReadXml method of dataset.

hope it helps
[]´s
Lafayette
 
J

Jon Skeet [C# MVP]

Fabiano said:
but how to use the memorystream.... do you have any sample?

You shouldn't need to convert into a MemoryStream at all - why bother
going to binary and back again? Just use a StringReader (which derives
from TextReader).
 

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