How to replace xml node value in jquery
<p>This is my code, i am using firefox's firebug (console.info)</p>

<pre><code> var productMap = {
    "1": "IIR"        
};

 $(xml).find('ConfigInfo').each(function(){
     var pid = $(this).find('productId').text();    
     $(this).find('productId').text(productMap[pid]);
     console.info($(this).find('productId').text());
 });

 $(xml).find('ConfigInfo').each(function(){
     console.info($(this).find('productId').text());
 });
</code></pre>

<p>My Xml</p>

<pre><code>&lt;list&gt;
&lt;com.abc.db.ConfigInfo&gt;
&lt;cfgId&gt;83&lt;/cfgId&gt;
&lt;cfgName&gt;test&lt;/cfgName&gt;
&lt;cfgDesc&gt;test&lt;/cfgDesc&gt;
&lt;cfgType&gt;test&lt;/cfgType&gt;
&lt;fileName&gt;csmclientbenz.xml&lt;/fileName&gt;
&lt;absolutePath&gt;../webapps/csm/files//1-105101/csmclientbenz.xml&lt;/absolutePath&gt;
&lt;emailAddress&gt;rmargasa@abc.com&lt;/emailAddress&gt;
&lt;projectId&gt;1-105101&lt;/projectId&gt;
&lt;hostname&gt;benz&lt;/hostname&gt;
&lt;createDate&gt;2011-06-15 15:29:55.0 IST&lt;/createDate&gt;
&lt;updateDate&gt;2011-06-15 15:29:55.0 IST&lt;/updateDate&gt;
&lt;state&gt;1&lt;/state&gt;
&lt;productId&gt;1&lt;/productId&gt;
&lt;/com.abc.db.ConfigInfo&gt;
&lt;com.abc.db.ConfigInfo&gt;
&lt;cfgId&gt;102&lt;/cfgId&gt;
&lt;cfgName&gt;cfgname1&lt;/cfgName&gt;
&lt;cfgDesc&gt;test&lt;/cfgDesc&gt;
&lt;cfgType&gt;test&lt;/cfgType&gt;
&lt;fileName&gt;csmclientestilo.xml&lt;/fileName&gt;
&lt;absolutePath&gt;../webapps/csm/files//1-105101/csmclientestilo.xml&lt;/absolutePath&gt;
&lt;emailAddress&gt;rmargasa@abc.com&lt;/emailAddress&gt;
&lt;projectId&gt;1-105101&lt;/projectId&gt;
&lt;hostname&gt;estilo&lt;/hostname&gt;
&lt;createDate&gt;2011-06-20 18:26:03.0 IST&lt;/createDate&gt;
&lt;updateDate&gt;2011-06-20 18:26:03.0 IST&lt;/updateDate&gt;
&lt;state&gt;1&lt;/state&gt;
&lt;productId&gt;1&lt;/productId&gt;
&lt;/com.abc.db.ConfigInfo&gt;
&lt;/list&gt;
</code></pre>

<p>My jqGrid code</p>

<pre><code>var xmlDoc = $.parseXML(xml); 
         $('#configDiv').empty();
            $('&lt;div width="100%"&gt;')
            .attr('id','configDetailsGrid')
            .html('&lt;table id="list1" width="100%"&gt;&lt;/table&gt;'+
                    '&lt;div id="gridpager"&gt;&lt;/div&gt;'+
                '&lt;/div&gt;')       
            .appendTo('#configDiv');    

            var grid = jQuery("#list1");

            grid.jqGrid({

              datastr : xml,
              datatype: 'xmlstring',
              colNames:['cfgId','','Name', 'Host', 'Description','Product', 'Type', 'Last Updated Time','Last Updated By',''],
              colModel:[
                  {name:'cfgId',index:'cfgId', width:90, align:"right", hidden:true},
                  {name:'',index:'', width:15, align:"right",edittype:'checkbox',formatter: "checkbox",editoptions: { value:"True:False"},editable:true,formatoptions: {disabled : false}},
                  {name:'cfgName',index:'cfgName', width:90, align:"right"},
                  {name:'hostname',index:'hostname', width:90, align:"right"},
                  {name:'cfgDesc',index:'cfgDesc', width:90, align:"right"},
                  {name:'productId',index:'productId', width:60, align:"right"},
                  {name:'cfgType',index:'cfgType', width:60, align:"right"},
                  {name:'updateDate',index:'updateDate',sorttype:'Date', width:120, align:"right"},
                  {name:'emailAddress',index:'emailAddress', width:120, align:"right"},
                  {name:'absolutePath',index:'absolutePath', width:90, align:"right", hidden:true},
              ],
              pager : '#gridpager',
              rowNum:10,
              scrollOffset:0,
              height: 'auto',

              autowidth:true,
              viewrecords: true,
              gridview: true,
              xmlReader: {
                  root : "list",
                  row: "com\\.abc\\.db\\.ConfigInfo",
                  userdata: "userdata",
                  repeatitems: false
              },
              onSelectRow: function(id,status){
                  var rowData = jQuery(this).getRowData(id); 
                  configid = rowData['cfgId'];
                  configname=rowData['cfgName'];
                  configdesc=rowData['cfgDesc'];
                  configenv=rowData['cfgType'];

                  if(status==true)
                  {

                  }

                  rowChecked=1;
                  currentrow=id;
                  },
              onCellSelect: function(rowid, index, contents, event) {
                  if(index==2)
                  {

                        $(xmlDoc).find('list com\\.abc\\.db\\.ConfigInfo').each(function()
                        {
                            //alert($(this).find('cfgId').text()+" "+configid);
                            if($(this).find('cfgId').text()==configid)  
                            {
                                configname=$(this).find('cfgName').text(); 
                                configdesc=$(this).find('cfgDesc').text();
                                configenv=$(this).find('cfgType').text();
                                filename=$(this).find('fileName').text();
                                updatedate=$(this).find('updateDate').text();
                                absolutepath=$(this).find('absolutePath').text();
                                productname=productMap[$(this).find('productId').text()];
                            }
                        });

                  }
               }

            });
            grid.jqGrid('navGrid','#gridpager',{edit:false,add:false,del:false});
</code></pre>

<p>This is what i get the output as. <strong>My question</strong>: How to replace an xml's node value?</p>

<p><img src="http://i.stack.imgur.com/LkQ8R.jpg" alt="enter image description here"></p>

<p><strong>Updated with my solution</strong></p>

<p>I used <code>xml=xml.replace(/&lt;productId&gt;1/g, "&lt;productId&gt;"+productMap['1']);</code> by adding a <code>/g</code> it replaced all my string occurances. </p>
