How to add and update element in xml file based match found after search

  • Thread starter Thread starter Sudip_inn
  • Start date Start date
S

Sudip_inn

Guest
suppose my xml look like

<?xml version="1.0" encoding="utf-8"?>
<TickerBrokerStandardDateLineitem>
<Ticker />
<TickerID />
<TickerBrokerStandardDateLineitemValues>
<TickerBrokerStandardDateLineitemValue>
<TabName>Consensus Model</TabName>
<StandardDate>2010 FY</StandardDate>
<XFundCode>TRIN</XFundCode>
<BRTab></BRTab>
<BRLineItem></BRLineItem>
<StandardLineItem>Total Sales</StandardLineItem>
<StandardValue></StandardValue>
<ActualProvidedByCompany>NO</ActualProvidedByCompany>
</TickerBrokerStandardDateLineitemValue>
<TickerBrokerStandardDateLineitemValue>
<TabName>Consensus Model</TabName>
<StandardDate>2011 FY</StandardDate>
<XFundCode>TRIN</XFundCode>
<BRTab></BRTab>
<BRLineItem></BRLineItem>
<StandardLineItem>Total Sales</StandardLineItem>
<StandardValue></StandardValue>
<ActualProvidedByCompany>NO</ActualProvidedByCompany>
</TickerBrokerStandardDateLineitemValue>
</TickerBrokerStandardDateLineitemValues>
</TickerBrokerStandardDateLineitem>

now i have to update XFundCode in all records of xml file if my supplied TabName & StandardLineItem match those records

also i have to add one element called ID=55 to each records if my supplied TabName & StandardLineItem match those records

so i have two task that i have to add one element called ID = 55 to each records if my TabName & StandardLineItem found in those records of xml file & i have to update also XFundCode element if my TabName & StandardLineItem found in those records of xml file.

Please share sample code to achieve this task. thanks

Continue reading...
 
Back
Top