How do I write XML from a dataset to Response, including schema?

A

Alan Silver

Hello,

I am trying to write some XML from a DataSet out to the Response object,
but I'm getting somewhat stuck.

I started out with ...

strXmlData = dstData.GetXml();
Response.Write(strXmlData);

which was fine, except it doesn't include the schema. I then discovered
that I should have been using WriteXML instead of GetXML, as that allows
me to tell it add the schema.

This is where I got stuck. I can't work out what to use for the first
parameter of WriteXML. The second one is the WriteSchema flag, but what
do I use for the first?

I tried ...

dstData.WriteXml(Response, XmlWriteMode.WriteSchema);

thinking that maybe Response was really a stream, but that didn't work.

So, anyone know how to do this? I just want the most efficient way of
sending the XML including schema to Response.

TIA for any help
 

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

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top