ReadXML in memory

  • Thread starter Thread starter Fabiano
  • Start date Start date
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
 
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.
 
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
 
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
 
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).
 
Back
Top