Home All Groups Group Topic Archive Search About

Converting XMLDatadocument for dataset

Author
24 Apr 2006 6:03 PM
srinivas
Hi,
I have to pass XML data to a procedure.
I'm having xml data in XMLDataDocument datatype.
Now i want to use this XMLDataDocument as an input to the dataset inside the
procedure.
But dataset.ReadXML accpets only Textreader/Stream/XMLReader.
Can anyone pls tell me how to convert the XMLDataDocument into
Textreader/Stream/XMLReader??

my code looks similar to something like this:

Private Sub Procedure1(ByVal xmldoc As XmlDataDocument)
//here i will call ReadXML method
ds.ReadXML(xmldoc).

Author
24 Apr 2006 9:33 PM
AMDRIT
Seems like you will need a system.io.stream (or some variant) to do as you
wish.

check out
http://www.syncfusion.com/library/cpref/html/frlrfsystemiomemorystreamclasstopic.htm

I don't know what an XMLDataDocument is, but if it has the .XML property
(returning the xml string of its contents) or the WriteXML method then you
are all set.

dim objStream as IO.MemoryStream
dim b() as byte = system.text.encoding.ascii.getbytes(xmlDoc.xml)
objStream.Read(b,0,b.length)

or

dim objStream as IO.MemoryStream
xmlDoc.WriteXML(objStream)


.... Then ...

ds.ReadXML(objStream)


Show quote
"srinivas" <srini***@discussions.microsoft.com> wrote in message
news:E631A8DF-332F-42A0-8807-2A72B5A310CE@microsoft.com...
> Hi,
> I have to pass XML data to a procedure.
> I'm having xml data in XMLDataDocument datatype.
> Now i want to use this XMLDataDocument as an input to the dataset inside
> the
> procedure.
> But dataset.ReadXML accpets only Textreader/Stream/XMLReader.
> Can anyone pls tell me how to convert the XMLDataDocument into
> Textreader/Stream/XMLReader??
>
> my code looks similar to something like this:
>
> Private Sub Procedure1(ByVal xmldoc As XmlDataDocument)
> //here i will call ReadXML method
> ds.ReadXML(xmldoc).
>
>
>

AddThis Social Bookmark Button