read / write to XML file, or better way to update XML

M

Maileen

Hi,

I have an existing XML file that i would like to update.
I know how to read it and how to write in XML file, but i have a problem
to update a value inside it.

for example the following XML file :

<?xml version="1.0"?>
<SLAReport>
<SourceFile>
<Configuration>
<ParameterIN id="Period" description="Period on which report has
been done">A1
</ParameterIN>
<ParameterIN id="FirstDataRow" description="Number of first row
which contains data for reporting">4
</ParameterIN>
<ParameterIN id="TypeIssueColumn" description="Letter of the
column which contains Request or Order">B
</ParameterIN>
</Configuration>
</SourceFile>
<OutputFile>
<ParameterOUT id="test 3">A 3rd test
</ParameterOUT>
<TemplateFile>
</TemplateFile>
</OutputFile>
</SLAReport>


In my application, user could change value of :

ParameterIN id="FirstDataRow" description="Number of first row which
contains data for reporting">4
</ParameterIN>

replacing 4 by 65.
i tried to getelementbyID, but it did not work.
so i can not write to this cursor place (i mean just replacing this 4 by
65) in XML file.
COuld someone help me please ?
thanks,

Maileen
 
C

Cor Ligthert [MVP]

Maileen,

Simple answer on a often asked question.

You first have to read it, change it in memory and rewrite it.

Or read it, change it and write in streaming to a new file.

Don't forget before you start to write the name to change the name of the
original when you do it in memory.

I hope this helps,

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top