CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2006
    Posts
    170

    XmlTextWrite question

    Hello!

    I am using a XmlTextWriter to make an xml structure that I want to save in an object not in a file. I tried this but this is wrong:

    Code:
    Stream xmlStream = new MemoryStream();
    
    XmlTextWriter xmlWriter = new XmlTextWriter(xmlStream, Encoding.UTF8);
    xmlWriter.WriteStartDocument(true);
    xmlWriter.WriteStartElement("Supplier"); //Root Element
    ...
    I want to send the result from the xmltextwriter to a webservice so the data has to be serializable.

  2. #2
    Join Date
    Jul 2007
    Location
    Illinois
    Posts
    517

    Re: XmlTextWrite question

    Go ahead and write the xml to the MemoryStream object and then call xmlStream.GetBuffer() which will return a byte[] you can send via a Socket.
    R.I.P. 3.5" Floppy Drives
    "I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones." - Albert Einstein

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured