Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Construct xml file in memory

Posted on 2006-11-14
3
Medium Priority
?
300 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 2000 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
Integration Management Part 2
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

886 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