How to use response output with a stringwriter?

D

darrel

I'm creating an RSS feed based off of this tutorial:

http://www.uberasp.net/ArticlePrint.aspx?id=17

In a nutshell, they are doing:

Response.Clear()
Response.ContentType = "text/xml"
....use xmltextwriter to create xml...
response.end()


I want to do the same, but instead of using an xmltextwriter, I'm using XSLT
to create the XML file. I'm stumped on how dto do this. I currently have:

Response.Clear()
Response.ContentType = "text/xml"
....set up xslt...
Dim sw As New StringWriter
xslt.Transform(doc, xslArg, sw, Nothing)
sw.Write(sw.ToString) // <-- where I'm stumped
response.end()

That doesn't work. How do I get a Stringwriter to output it's content into
the response?

-Darrel
 
D

darrel

That doesn't work. How do I get a Stringwriter to output it's content
into the response?

Ok, this has to be one of the biggest brainfarts I ever had.

response.write(sw.tostring)

duh! ;o)

-Darrel
 
C

Cowboy \(Gregory A. Beamer\)

Since you are transforming, you probably have an HTML page (not necessarily
as you can make XML + XSLT = XML or XML + XSLT = text). If you do have an
HTML page, get rid of the text/xml. You will have to go to a stream, not a
streamwriter.

The final chapters of ADO.NET and XML: ASP.NET on the edge show a 1.0
transform to a stream (it is different in 2.0). You can download from
http://www.wiley.com/extras. This will at least have you understand writing
to a stream. Unfortunately, I do not have a 2.0 code sample, but it should
be fairly similar, although the transform class has changed. Short story:
The downloaded code WILL blow up in 2.0, but it is useful for understanding
the idea.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*********************************************
Think outside the box!
*********************************************
 
C

Cowboy \(Gregory A. Beamer\)

I find those right after I hit send. :)

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*********************************************
Think outside the box!
*********************************************
 

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

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top