Stringbuilder equivalent to XMLTextWriter?

D

darrel

I want to write an XML file but not to a file...just into memory, so I can
then pass it to a string and stick it in a database.

Seems that XMLtextWriter requires that I write to a filestream.

What I'm looking for is the ease of writing XML that XMLTextWriter has with
the ability to just write to memory like Stringbuilder can do. Is there such
a thing?

-Darrel
 
D

darrel

What I'm looking for is the ease of writing XML that XMLTextWriter has
with the ability to just write to memory like Stringbuilder can do. Is
there such a thing?

Hmm...I found this article:

http://www.15seconds.com/issue/050615.htm

Which mentions:

"the XmlWriter can generate its output as a disk file, a stream, a
StringBuilder or another writer instance."

So, it looks like it can generate a stringbuilder. I just need to find an
example of that... ;o)

-Darrel
 
D

darrel

So, it looks like it can generate a stringbuilder. I just need to find an
example of that... ;o)

A bit more digging and I think I've figure it out:

Dim sbXML As New System.Text.StringBuilder

Dim swXML As New System.IO.StringWriter(sbXML)

Dim twXML As New System.xml.XmlTextWriter(swXML)

-Darrel
 

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