Solved

Construct xml file in memory

Posted on 2006-11-14
3
295 Views
Last Modified: 2008-02-01
Hi,

I have to create a class which construct an xml file in memory (means not in a file) with tags and specific values and return that file to the calling method).

How can i do that?

0
Comment
Question by:Rahamathulla_J
3 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 500 total points
ID: 17937779
You can create XmlDocument instance which is actually memory representation of XML file. XmlDocument constructor creates empty XML document. Then use AppendChild to add root node, and XmlNode.AppendChild to add childs to root node. You can return XmlDocument instance to the caller.
You can also save XmlDocument to MemoryStream using XmlDocument.Save(Stream) method. Stream is organized like file and can be handled by client like FileStream created from XML file. You can decide to return Stream instance to the caller. In this case caller can handle return value by the same way as FileStream.
0
 

Author Comment

by:Rahamathulla_J
ID: 17938364
Hi,

I want to construct this same like xml file in memory?

xml version="1.0" encoding="utf-8" ?>
- <BP>
- <Message status="CREATED" identifier="786">
  <origin>ata</origin>
  <reci>data</reci>
  <Type>8</Type>
  <CRC>crc</CRC>
  </Message>

  <original>1</original>

- <Sign>
  <data>F9</data>
  <Id>ICMS1_01</Id>
  <algo>01</algo>
  </Sign>
  </BP>
0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question