[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 165
  • Last Modified:

read write xml alternatives?

Hello,

at the moment i am putting togetther an app which uses xml as a data repositry

anytime i need to write to a file at the moment i have to

read in the source xml to a ds
modify the ds
archive/delete the source
write a new source file

getting a 1000 line item xml file in memory then having to rewrite the whole xml file seems like a bit of an overhead are there any better (possibly by streaming the file) methods than
<pseudo_code>

dim ds as new dataset
dim strfilename as string = "C:\file.xml"
dim dr as new datarow
ds.readxml(strfilename)

for each dr in ds.tables(0).rows
if dr("Update_flag")  = "A" then
dr.beginedit
dr("Update_Flag") = "N"
dr.endedit
next

'function archives source xml to a different laction with a datestamp
archivexml(strfilename)

ds.writexml(strFileName)

Thanks

Mark










 
0
markofsoton
Asked:
markofsoton
1 Solution
 
Arthur_WoodCommented:
can't you use the XML DomDocument object, then selectSingleNode to read a specific node into a Node object, and update the Text property of the Node object?

If you need to add a new node, you can create a node off the DOMDocument object, and then use appendChild to add the new node at the appropriate place in the Node structure.  We are doing precisly this (though use VBA in Excel), and it works like a charm.

AW
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now