473,397 Members | 2,116 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,397 software developers and data experts.

modify value into XML file

Hi,

I've asked yesterday if someone already modify data into XML file using
VB.NET.

In fact, my XML file is like that.

....
<DB>
<DB_Loc>
mytext
</DB_Loc>
</DB>
<SETTINGS>
....
</SETTINGS>
....

I would like to modify my text "mytext" and replace it by some other value.

How can I do this ?
thanks,
Maileen
Nov 21 '05 #1
3 13352
Hi Maileen

Without testing...

Dim d As New System.Xml.XmlDocument
d.LoadXml("<DB><DB_Loc>mytext</DB_Loc></DB>")
Dim n As System.Xml.XmlNode = d.SelectSingleNode("//DB/DB_Loc") ' your
example implies that DB is not the root element...
n.InnerText = "A new value"
d.Save("C:\test.xml")

HTH

Nigel Armstrong

"Maileen" wrote:
Hi,

I've asked yesterday if someone already modify data into XML file using
VB.NET.

In fact, my XML file is like that.

....
<DB>
<DB_Loc>
mytext
</DB_Loc>
</DB>
<SETTINGS>
....
</SETTINGS>
....

I would like to modify my text "mytext" and replace it by some other value.

How can I do this ?
thanks,
Maileen

Nov 21 '05 #2
but in your example, i don't load the XML source file
before...everything is done in memory.

before to modify data of node, I want to open the XML file and modify
directly to XML file the value.

Maileen

Nigel Armstrong wrote:
Hi Maileen

Without testing...

Dim d As New System.Xml.XmlDocument
d.LoadXml("<DB><DB_Loc>mytext</DB_Loc></DB>")
Dim n As System.Xml.XmlNode = d.SelectSingleNode("//DB/DB_Loc") ' your
example implies that DB is not the root element...
n.InnerText = "A new value"
d.Save("C:\test.xml")

HTH

Nigel Armstrong

"Maileen" wrote:

Hi,

I've asked yesterday if someone already modify data into XML file using
VB.NET.

In fact, my XML file is like that.

....
<DB>
<DB_Loc>
mytext
</DB_Loc>
</DB>
<SETTINGS>
....
</SETTINGS>
....

I would like to modify my text "mytext" and replace it by some other value.

How can I do this ?
thanks,
Maileen

Nov 21 '05 #3
I've discovered where was the mistake.
I don't know why, but VB wrote the changes into another folder than
where it should be done, so never my xml file was modified even if
folder and file variable where correct.

so code is good.
Maileen

Nigel Armstrong wrote:
Hi Maileen

Without testing...

Dim d As New System.Xml.XmlDocument
d.LoadXml("<DB><DB_Loc>mytext</DB_Loc></DB>")
Dim n As System.Xml.XmlNode = d.SelectSingleNode("//DB/DB_Loc") ' your
example implies that DB is not the root element...
n.InnerText = "A new value"
d.Save("C:\test.xml")

HTH

Nigel Armstrong

"Maileen" wrote:

Hi,

I've asked yesterday if someone already modify data into XML file using
VB.NET.

In fact, my XML file is like that.

....
<DB>
<DB_Loc>
mytext
</DB_Loc>
</DB>
<SETTINGS>
....
</SETTINGS>
....

I would like to modify my text "mytext" and replace it by some other value.

How can I do this ?
thanks,
Maileen

Nov 21 '05 #4

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

Similar topics

3
by: Job Lot | last post by:
How can I modify values in text file? File is tab delimited as follows Date Buy Sell 13-Jan-2005 0.9970776 0.9901224 18-Jan-2005 0.9910566 0.9841434 I want to modify Buy and Sell...
12
by: Venkat | last post by:
Greetings to All, I have the following file and i need to modify it with the contents of an array File1.txt Name Location Points Grade Venkat,Newyork,100,A Jack,LA,12,C
2
by: Elby | last post by:
I'm looking for a the most simple and generic way to modify a file, with the possibility of making backups. In fact, I would like to emulate Perl's -i option. here is a bit of code, to explain...
4
by: jp.delatorre | last post by:
how to create script that modify xml file sample xml file: <root> <parent name="a" id="1"> <child name="a.a" id="1.1" /> <child name="a.b" id="1.2" /> <child name="a.c" id="1.3" />...
5
by: Alberto | last post by:
I need to modify a value in the app.config file with this code: System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); string key =...
1
by: LB | last post by:
Hi, I want to modify my file ".vbproj". I use XML dlls of Visual Studio and that causes to modify the format of the file .vbproj and that causes problems at the compile time on another servor....
0
by: nkw | last post by:
My Asp.net execute a SSIS package which will modify an MDB file. It always failed. However, I can execute the SSIS package using dtexec. Should I modify the file permissions of the MDB file? If...
1
by: Joey | last post by:
Is this possible? I have an app where we are using forms authentication and are allow editing/changing of security role names. Since I have set permissions with <locationtags in web.config (i.e....
1
by: hwee | last post by:
When a file changes (.doc or .txt file) by some user, is there away to find out who modify that file in vb.net? I know how to find the creator of the file but not the one, who modify the file.
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: 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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.