473,395 Members | 1,568 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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

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
Nov 21 '05 #1
2 1164
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
Nov 21 '05 #2
Can you show some of your code that you're using?

Maileen wrote:
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

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Yang Li Ke | last post by:
Hi guys! I have some datas that I must check everytime a visitor comes to my site What is better to do: 1- Read data from a file or 2- Read data from a mysql db Thank you
0
by: mr_wizard | last post by:
I posted a message yesterday on my difficulty in updating an Access table. Yesterday the error response was permission related. I've gotten past that, but still cannot update the table. XP Pro...
5
by: Martin Svensson | last post by:
Hello! I need some help/recommendations on how to do the following. I have a program that writes an IP address two control numbers and a date to file, on one line. It's a basic text file and it...
35
by: RyanS09 | last post by:
Hello- I am trying to write a snippet which will open a text file with an integer on each line. I would like to read the last integer in the file. I am currently using: file = fopen("f.txt",...
5
by: kevin | last post by:
Hi, Hope you can help - I can't see the wood for the trees any more. I currently have a local MS Access file. I'd like to do this in VB.NET: connect to file (select * from table) for...
6
by: | last post by:
Hi, I'm steel trying to read and update my XML file with Visual Basic Express but i am unable to find the right way to read my xml file and update it if neccessary... Here is my problem :...
4
by: thiago777 | last post by:
I have only 1GB of RAM so I cannot work with files too big with the ReadtoEnd method. Here is the code Im trying so that the file would split in pieces of 256MB: Try Dim BInput...
9
by: =?Utf-8?B?QnJpYW4gQ29vaw==?= | last post by:
I want to open a text file and format it into a specific line and then apply color to a specific location of the text and then display it in a RichTextBox after all of this is done. I can do all...
2
by: Kevin Ar18 | last post by:
I posted this on the forum, but nobody seems to know the solution: http://python-forum.org/py/viewtopic.php?t=5230 I have a zip file that is several GB in size, and one of the files inside of it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.