Solved

Construct xml file in memory

Posted on 2006-11-14
3
293 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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now