473,785 Members | 2,234 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

modify xml node

1 New Member
Hi,

Let's say I have a table with xml column.
I would like to update this xml as following:
my xml looks like this:

Expand|Select|Wrap|Line Numbers
  1. <ArrayOfValueHolder xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  2.   <ValueHolder>
  3.     <Value>3.00</Value>
  4.     <IsNoteDirty>false</IsNoteDirty>
  5.     <Timestamp>
  6.       <StampType>Month</StampType>
  7.       <Stamp>3</Stamp>
  8.       <Year>2007</Year>
  9.     </Timestamp>
  10.   </ValueHolder>
  11.   <ValueHolder>
  12.     <Value xsi:nil="true" />
  13.     <IsNoteDirty>false</IsNoteDirty>
  14.     <Timestamp>
  15.       <StampType>Month</StampType>
  16.       <Stamp>4</Stamp>
  17.       <Year>2007</Year>
  18.     </Timestamp>
  19.   </ValueHolder>
  20.   <ValueHolder>
  21.     <Value>2.00</Value>
  22.     <IsNoteDirty>false</IsNoteDirty>
  23.     <Timestamp>
  24.       <StampType>Month</StampType>
  25.       <Stamp>5</Stamp>
  26.       <Year>2007</Year>
  27.     </Timestamp>
  28.   </ValueHolder>
  29.   <ValueHolder>
  30.     <Value>5.00</Value>
  31.     <IsNoteDirty>false</IsNoteDirty>
  32.     <Timestamp>
  33.       <StampType>Month</StampType>
  34.       <Stamp>6</Stamp>
  35.       <Year>2007</Year>
  36.     </Timestamp>
  37.   </ValueHolder>
  38. </ArrayOfValueHolder>
I want to modify the "value" node but only where: Year = 2007 and Stamp = 6 and I don't know what's the number of this node so i can't write:
xml.modify(repl ace value of (.//Value/text())[4] .... ) for example
how can i do it?
Apr 22 '07 #1
1 1900
dorinbogdan
839 Recognized Expert Contributor
Welcome to TheScripts TSDN...

What language are you using?
Please post your current code, to test it here.

Thanks,
Dorin.
Apr 23 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
3238
by: Sherman Willden | last post by:
I am trying to use Perl's XML::Twig to modify a version number in an XML document. At the very end of this posting is an excerpt from the xml document. Just before the xml excerpt is the Perl code I am trying to use. The Xpath part of the script functions well. I think I need help determining the @field entry. I have tried //property/string, version/string, and string. I get a "Can't modify non-lvalue subroutine call at C:\business...
4
1658
by: titanandrews | last post by:
Hi, I have ran into a situation that I think should be possible, but I am fairly new to XSLT so maybe not. Suppose I have the following document <ROOT> <FOO name="A"> <CHILD name="B"/> </FOO>
1
1394
by: mike | last post by:
I have a stylesheet embedded in my html page like: <xml id="xslFix"> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="html"/> <xsl:param name="statusfield"></xsl:param> ......<snip>.... </xml>
0
1319
by: KathyB | last post by:
Hi, I've spent the past 2 days reading EVERYTHING I could find on this...but still foggy. If someone could give me an example of how to do the following: I have an xml doc (step-by-step instructions, not a data-type doc), transformed using an xsl stylesheet in an asp.net web control. In the html result, I have <step> elements, some of which have a user
3
13394
by: Maileen | last post by:
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>
0
999
by: Feng | last post by:
Sorry about the last post. Made a mistake by clicking on the Post before finishing... I have a task that seems easy but I still don't have a symple way to do it: I need to read in an exasting XML file, find a certain node using XPath, change the value of the node, then save it back to the file. So, as you see, only the value of one entry needs to be changed. Everything else will be kept the same.
1
1308
by: shukyh | last post by:
Hi All i have a XML file with 12 element named "device", and attribute named "project". i wanted to change only the value of one attribute. i tried: XmlNodeList nList = doc.GetElementsByTagName("device"); foreach (XmlNode node in nList) { node.Attributes.InnerXml = "aaa"; }
3
4704
by: dutsnekcirf | last post by:
I have a treeview control on a custom task pane in Excel. I've enable the ability to use Drag & Drop (by following this how-to) on the treeview to change the order of the nodes. The problem though is if I close the application and then go back in, the nodes are back in the order they were before I had reordered them. Is there a way that I can modify my DragDrop event to permanently change the index of the nodes? Here's my code if you're...
3
1687
by: mbh1 | last post by:
hi, ive created a certain tree view, which i want to modify (in run time) on a certain button click. how can i change a certain node label name and how can i change its image (assume i have images in a image list) thanks!
0
9645
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
9481
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10341
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
10155
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
10095
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
9954
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5513
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3656
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2881
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.