• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to replace node value in XML and save

Praneeth30

New Member
Hi -

I have a XML file and have to replace some node values of the XML. After the values are replaced have to save it back into XML format.

Appreciate your help in this..This is how my XML looks like.

<CHCOMMST_REC>
<CHCOMMST_KEY_AREA>
<KEY_DIKY_CLM_SYS_ID>COSM</KEY_DIKY_CLM_SYS_ID>
<KEY_DIKY_INVN_CTL_NBR>1000075830</KEY_DIKY_INVN_CTL_NBR>
<KEY_DIKY_PROCESS_FLOW_KEY>ADJCLM</KEY_DIKY_PROCESS_FLOW_KEY>
<KEY_DIKY_SUFFIX_CD>01</KEY_DIKY_SUFFIX_CD>
<KEY_DIKY_GLOBL_SYS_ID>1001</KEY_DIKY_GLOBL_SYS_ID>
<KEY_DIKY_CAE_CLM_ID>UBM00000043420140609</KEY_DIKY_CAE_CLM_ID>
<KEY_DIKY_PROC_DT>2014-11-20</KEY_DIKY_PROC_DT>
<CHCOMMST_REC>
<CHCOMMST_KEY_AREA>

For example:
I have to replace the tag value of KEY_DIKY_CLM_SYS_ID from COSM to PNIC and
KEY_DIKY_PROC_DT from 2014-11-20 to 2016-05-04
 
Hi !

Read the global file as a single text file within a string variable,
just use Replace VBA function then save file …

In fact you ever don't need a code for this, just use Search & Replace
within a text editor like Notepad for example !
 
Hi !

Read the global file as a single text file within a string variable,
just use Replace VBA function then save file …

In fact you ever don't need a code for this, just use Search & Replace
within a text editor like Notepad for example !

Hi Marc,

My XML contains 1000 tags a minimum.. so i cannot use search and replace if i want to replace 100 tags.. that is why i was looking for some code which can do so.

Thanks!
 

So as I wrote, your way is to use Replace VBA function …

Or use Excel xml functions, activate Macro recorder before manual operations, open file, search & replace, save : you have a code base !
 
Back
Top