Deleting a Node from XML String
Hi All,
$(document).ready(function () {
var EmailXml = "<Set>";
EmailXml += "<Email>"
EmailXml +="<Type>0</Type>";
EmailXml +="</Email>";
EmailXml +="<Email>"
EmailXml +="<Type>1</Type>";
EmailXml +="</Email>";EmailXml +="<Email>"
EmailXml +="</Set>";
var dom = LoadXmlDocument(EmailXml);
$(dom).find('Email').each(function () {
alert($(
this).text());
});
});
the following allows me traverse by <Type>
$(dom).find('Email').each(function() {
var msg = "";
switch (+$(this).find("Type").text()) {
case 0: msg = 'action0';
break;
case 1: msg = 'action1';
break;
case 2: msg = 'action2';
break;
}
});
Now I am trying to delete a node directly from above EmailXml , though it is possible with above code when case matches with my Type, I can do some string operations and get the result. But is there any other method which removes the node directly ?