Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old March 5th, 2007, 08:27 PM
MAF
Guest
 
Posts: n/a
Default XML , text, from xmlwriter.

Is there a simple way to get the text, xml, from an xmlwriter.

I have a XML writer that writes to a file, and I want another function to
return the text that the xml writer is produced.

Any suggestions?


  #2  
Old March 6th, 2007, 12:35 PM
Martin Honnen
Guest
 
Posts: n/a
Default Re: XML , text, from xmlwriter.

MAF wrote:
Quote:
Is there a simple way to get the text, xml, from an xmlwriter.
>
I have a XML writer that writes to a file, and I want another function to
return the text that the xml writer is produced.
Use an XmlWriter over a StringWriter e.g.
StringWriter stringWriter = new StringWriter();
using (XmlWriter xmlWriter = XmlWriter.Create(stringWriter)) {
xmlWriter.WriteStartDocument();
xmlWriter.WriteStartElement("root");
xmlWriter.WriteElementString("element", "Kibo");
xmlWriter.WriteEndDocument();
}
string xml = stringWriter.ToString();

StringWriter is in System.IO.


--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles