modify xml node

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sharonu
    New Member
    • Apr 2007
    • 1

    modify xml node

    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:

    Code:
    <ArrayOfValueHolder xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <ValueHolder>
        <Value>3.00</Value>
        <IsNoteDirty>false</IsNoteDirty>
        <Timestamp>
          <StampType>Month</StampType>
          <Stamp>3</Stamp>
          <Year>2007</Year>
        </Timestamp>
      </ValueHolder>
      <ValueHolder>
        <Value xsi:nil="true" />
        <IsNoteDirty>false</IsNoteDirty>
        <Timestamp>
          <StampType>Month</StampType>
          <Stamp>4</Stamp>
          <Year>2007</Year>
        </Timestamp>
      </ValueHolder>
      <ValueHolder>
        <Value>2.00</Value>
        <IsNoteDirty>false</IsNoteDirty>
        <Timestamp>
          <StampType>Month</StampType>
          <Stamp>5</Stamp>
          <Year>2007</Year>
        </Timestamp>
      </ValueHolder>
      <ValueHolder>
        <Value>5.00</Value>
        <IsNoteDirty>false</IsNoteDirty>
        <Timestamp>
          <StampType>Month</StampType>
          <Stamp>6</Stamp>
          <Year>2007</Year>
        </Timestamp>
      </ValueHolder>
    </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?
  • dorinbogdan
    Recognized Expert Contributor
    • Feb 2007
    • 839

    #2
    Welcome to TheScripts TSDN...

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

    Thanks,
    Dorin.

    Comment

    Working...