I needed to replace then node having field name with the xml node.
I tried with replaceWith
which did not parse properly.
As suggested here I tried to create a workaround to replace xml tag
$.fn.replaceWithXML = function replaceWithXML(ele) { var xml = this.html(); return $('<dummy />').append($(ele).append(xml)).html(); }
xml = '<field><col>Col1</col></field>' xml = $.parseXML(xml);
Replacing the "field" with "column" yields unexpected output ''
Neither this works
var xml_node = '<column></column>'; $(root).append(xml_node,{html: $(xml ).find('field').html()});
Nor this works
$(root).append($(xml_node).append($(xml ).find('field').html()));
I created a jsfiddle to show the output after parsing