Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8569029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:14:26+00:00 2026-06-11T18:14:26+00:00

I would like to export(convert) XmlTextWriter output data to string variable. My code as

  • 0

I would like to export(convert) XmlTextWriter output data to string variable.

My code as follows :

        '' write data as xml
        Dim objX As New XmlTextWriter(Response.OutputStream, Encoding.UTF8)
        objX.WriteStartDocument()
        objX.WriteStartElement("Transaction")
        objX.WriteAttributeString("version", "1.0")
        objX.WriteElementString("id", "12")
        objX.WriteElementString("token", "4534gfdgdfhfst")


        objX.WriteEndElement()

        objX.WriteEndDocument()

        objX.Flush()

        objX.Close()
        Response.End()

the xml output am getting now is like this : 38824e4760a1b72f9bd95723a3bdffbd02280010.50en3475990rapids1 month rapidshare0.46587748175.136.184.1539/14/2012d7a1ff2200f9fe7b8b89d12fdc8be8f36293‌​712eS. how to make it as xml tags

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T18:14:27+00:00Added an answer on June 11, 2026 at 6:14 pm

    You have configured the XmlTextWriter to write directly to the Response.OutputStream. If you wanted to export it to a string variable you could use a StringWriter that will write to a StringBuilder.

    Dim sb As New StringBuilder()
    Using sw As New StringWriter(sb)
        Using writer = XmlWriter.Create(sw)
            ' write the XML to the writer here
        End Using
    End Using
    ' At this stage the StringBuilder will contain the generated XML.
    

    as an alternative you could write to a MemoryStream:

    Using stream As New MemoryStream()
        Using writer = XmlWriter.Create(stream)
            ' write the XML to the writer here
    
            Dim xml As String = Encoding.UTF8.GetString(stream.ToArray())
            ' TODO: do something with the generated XML
        End Using
    End Using
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Excel table with some data that I would like to export
My XML looks like this. I would like to export collected_objects into another document.
From our existing, internal tracking system I would like to create an XML export
I would like to convert a string containing a valid Erlang expression to its
Let's say I write a DLL in C++ and would like to export a
I would like to export a subset of my Redis data on the slave
I would like to export (.txt or .cvs) data plotted on a graph by
I would like to export some macros that I have defined and be able
I would like to export a Java Bean or ResultSet(JDBC) into a CSV file
I'm using IIS6 using powershell I would like to export a specific virtual directory

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.