Solved

Construct xml file in memory

Posted on 2006-11-14
3
296 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that undeā€¦
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

791 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