473,698 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Change Value of Existing Element

Lee

I have an xml Structure:

<?xml version="1.0" encoding="utf-16"?>
<Request>
<Operations>
<Command>
<OpType>login </OpType>
<Params>
<UserName>leebo </UserName>
<Password>leebo </Password>
</Params>
</Command>
</Operations>
</Request>

I'm trying to find out how to change the value of an element, say
<userName>joh n</UserName>

I'm using an XmlDocument, but I've been searching MSDN and google
groups for a couple of hours and I can't seem to find an answer.

Must I create and use an XMLWriter to perform this one small function?

Basically, I just need to change one element's value.

Sorry for such as basic question.

--
Warm Regards,

Lee
Nov 21 '05 #1
2 1279
Hi,

Yes. You must read in the document and write it back with the
changes.

Ken
------------------
"Lee" <lu************ *@yahoo.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..

I have an xml Structure:

<?xml version="1.0" encoding="utf-16"?>
<Request>
<Operations>
<Command>
<OpType>login </OpType>
<Params>
<UserName>leebo </UserName>
<Password>leebo </Password>
</Params>
</Command>
</Operations>
</Request>

I'm trying to find out how to change the value of an element, say
<userName>joh n</UserName>

I'm using an XmlDocument, but I've been searching MSDN and google
groups for a couple of hours and I can't seem to find an answer.

Must I create and use an XMLWriter to perform this one small function?

Basically, I just need to change one element's value.

Sorry for such as basic question.

--
Warm Regards,

Lee
Nov 21 '05 #2
Lee
Ken Tucker [MVP] enlightened me by writing:
Hi,

Yes. You must read in the document and write it back
with the changes.

Ken


Thanks Ken. Can you provide a link to sample? I'd really appreciate
it.

Thanks again,

--
Warm Regards,

Lee
Nov 21 '05 #3

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

Similar topics

3
16177
by: Sarah West | last post by:
Hi, I have the following problem; This is my form, i would like to default the select box to USA, and default the text field to a name such as 'Sarah' and the hidden field to another number like '876543', when the user clicks on the check box, otherwise the fields should be blank, the value of the select box dosnt matter much, only that it defaults to USA, when the user checks it. Can anyone help? i have tried a google with no luck,...
0
1056
by: KemperR | last post by:
Dear Experts, I'm new to docbook and have sucessfully started to get into customisation layers. Therefore I changed the dtd as recomended. But I got stuck at the simple point when I want to add existing classes to my new elements. E.g I would like to see every thing of the para.class to my new element eeabastract. Please find my DTD below: My problem is that I can only refer to an existing class after %DocBookDTD is called. But than I...
2
1859
by: Nick Calladine | last post by:
Is this possible to ... I wish to get the value of a dropdown select but gets is indexable value (dont know if that is the right term) if that is possible (the position it assigned get assigned by the position on the list) this is so i can then pass it to the array called pictureimage to get the correct filename (similar to the picturetext part of this routine) and then the final line on the fuction is to change an original image with...
3
13392
by: Frankie | last post by:
I'm writing a small utility app (C# Windows forms) used to create new ASP.NET Web sites. This utility needs to be able to change existing values in an existing Web.config. Please note: I do NOT want to make this change from any currently running Web application. Rather, I plan to have a "base/standard Web.config" that is copied then updated by the utility app for each new Web site. I'm hoping there is some straight-forward way to do...
6
12761
by: libsfan01 | last post by:
hi all! is it possible to change an element type with javacript for example onclick to change a text box to a hidden element or to a textarea? kind regards marc
2
12432
by: Eric Layman | last post by:
Hi, I have a radio button and a combo box. Upon changing a value for radio button, the combo box values will be dynamically updated. I have an idea on how to go abt doing it but Im stuck into converting into code.
23
3657
by: Jess | last post by:
Hello, I understand the default-initialization happens if we don't initialize an object explicitly. I think for an object of a class type, the value is determined by the constructor, and for the built-in types, the value is usually garbage. Is this right? However, I'm a bit confused about value-initialization, when does it happen, and what kind of values are assigned to objects?
5
13187
by: yhlove | last post by:
Hi I'm trying to change element in xml file as described below: the xml file: ---------------- <MyProg> <Path>test1</Path> </MyProg>
5
7180
by: moondaddy | last post by:
I have a custom control where users can set the backcolor of one of it's UI elements via a DP I created. One of the colors they can pick is a brush called CustomGradient where I would set the DP to this brush. Then from a color picker I would let them pick a solid color brush and set 2 of the gradient stops to this new value. So for example, here's the style:
0
8673
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9156
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9021
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8892
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7716
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4365
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4614
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
1998
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.